Re: [HACKERS] Range Merge Join v1 - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: [HACKERS] Range Merge Join v1
Date
Msg-id CAMp0ubcvHpsims+Sy6xVz6k2n5-S=hoOhRWuvROEKYRQYvcg=Q@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Range Merge Join v1  (Andrew Borodin <borodin@octonica.com>)
Responses Re: [HACKERS] Range Merge Join v1  (Andrew Borodin <borodin@octonica.com>)
List pgsql-hackers
On Tue, May 30, 2017 at 11:44 PM, Andrew Borodin <borodin@octonica.com> wrote:
> Hi, Jeff!

Hi!

> Sorry for being late. Actually, I had several unsuccessful attempts to
> find something wrong with the patch.
> Here's my review.
>
> in pathkey.c
>
> ecs = (EquivalenceClass **) palloc(nClauses * sizeof(EquivalenceClass *));
> scores = (int *) palloc(nClauses * sizeof(int));
> range_ecs = palloc(nClauses * sizeof(bool));
>
> Third assignment has no cast.

Will fix.

> And I have few questions:
> 1. Are there any types, which could benefit from Range Merge and are
> not covered by this patch?

I thought about this for a while, and the only thing I can think of
are range joins that don't explicitly use range types.

> 2. Can Range Merge handle merge of different ranges? Like int4range()
> && int8range() ?

Right now, there aren't even casts between range types. I think the
best way to handle that at this point would be to add casts among the
numeric ranges. There may be advantages to supporting any two ranges
where the contained types are part of the same opfamily, but it seems
a little early to add that complication.

> My perf test script from the previous message was broken, here's fixed
> one in the attachment.
>
> This patch implements feature, contains new tests and passes old
> tests, is documented and spec compliant. I do not see any reason why
> not mark it "Ready for committer".

Great!

I think there are a couple more things that could be done if we want
to. Let me know if you think these things should be done now, or if
they should be a separate patch later when the need arises:

* Support for r1 @> r2 joins (join on "contains" rather than "overlaps").
* Better integration with the catalog so that users could add their
own types that support range merge join.

Thank you for the review.

Regards,    Jeff Davis



pgsql-hackers by date:

Previous
From: Claudio Freire
Date:
Subject: Re: [HACKERS] Perfomance bug in v10
Next
From: Teodor Sigaev
Date:
Subject: Re: [HACKERS] Perfomance bug in v10