Re: Rangejoin rebased - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Rangejoin rebased
Date
Msg-id CAMp0ubfNe2mGZ3H8WEmdPP26-PGYODSfJhWj83+CTyyXou0PSw@mail.gmail.com
Whole thread Raw
In response to Re: Rangejoin rebased  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers
On Tue, Jan 23, 2018 at 2:04 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> Perhaps we are misunderstanding each other
>
> TIMESTAMP <@ RANGE1 doesn't match if RANGE1 is empty
> and that is the most important case

When <@ is supported, that case should be fine if range1 is on the
outer. The case I was concerned about is with a R1 <@ R2 join where R1
is on the inner side and could have empty ranges.

One option would be to try to force R2 to be on the inner. But that
doesn't quite solve other related issues, like if R2 has a few large
ranges that contain almost everything.

Right now I'm considering an approach where we use some counters to
determine that a few ranges are preventing us from moving the mark
forward, and then move those few ranges into a separate tuplestore so
that we can move the mark forward.

> RANGE OP RANGE is important also. It would be useful for OP to be more
> than just &&

I agree that contains/contained-by are useful; do you have other
operators in mind as well?

>
> It's certainly weird that R1 @> EMPTY is true, but R1 && EMPTY is not.

This was discussed back in 9.2, and there were no obviously better
semantics available. I chose to follow set semantics: X contains Y
means that Y is a subset of X; X overlaps Y means that the
intersection of X and Y is nonempty.

I understand it can be surprising, but other definitions can be surprising, too.

Regards,
     Jeff Davis


pgsql-hackers by date:

Previous
From: "Tsunakawa, Takayuki"
Date:
Subject: Temporary tables prevent autovacuum, leading to XID wraparound
Next
From: Jeff Davis
Date:
Subject: Re: JIT compiling with LLVM v9.0