Hi Jeff,

Fast range joins are very nice to have, thank you for working on this.

I've been doing a somewhat related thing recently, trying to teach the merge join executor to perform full joins on comparison clauses [1]. I have some comments after reading your patch:

* At the moment, "mergejoinable clause" and "equality clause" mean the same thing to the planner, and those clauses are used both to create equivalence classes and to perform merge joins. If we start performing merge joins for different kinds of clauses, such as comparison or range intersection, it makes sense to separate these two meanings. I tried this in my patch and it didn't require many changes. I use RestrictInfo.equivopfamilies to build equivalence classes, and RestrictInfo.mergeopfamilies for mergejoinable clauses.

* Semantically, MJCompare() is a function that determines whether you should emit a join result or advance one of the pointers. This meaning is not explicit in the code and is not well encapsulated: the function returns and int and 'compareNoMatch' flag, and the calling code combines them in various ways to derive the final result. This meaning can be made explicit by making MJCompare return enum values {Join, NextInner, NextOuter}, and putting inside it all the logic that decides whether we join or advance. ExecMergeJoin looks intimidating already, and I think this change would help readability. Again, you can find an illustration in my patch.

I hope you find these points helpful.

[1] https://www.postgresql.org/message-id/flat/1d23ad41-a9d9-1d1e-1d79-83b002d6f776%40postgrespro.ru#1d23ad41-a9d9-1d1e-1d79-83b002d6f...@postgrespro.ru

--
Alexander Kuzmenkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to