Nested loop join implementation

113 views
Skip to first unread message

impradee

unread,
Feb 15, 2021, 6:51:15 AM2/15/21
to H2 Database
Hi , 

I couldn't find the nested loop join implementation in the src directory. Where is the nested loop join implementation is located ? Any help would be greatly appreciated. 

Thank You
Regard, 
Pradeepa

Evgenij Ryazanov

unread,
Feb 15, 2021, 7:23:26 AM2/15/21
to H2 Database

impradee

unread,
Feb 15, 2021, 8:07:13 AM2/15/21
to H2 Database
Hi, 

Thank you very much for your reply. I have another question. I want to implement join algorithms such as hash join, indexed nested loop join, merge join etc. Where would I start? Also, I was wondering why these join algorithms are not implemented currently?

Thank You
Regards,
Pradeepa

impradee

unread,
Feb 15, 2021, 12:12:04 PM2/15/21
to H2 Database
Hi Evgenij,

I am looking for the nested loop join implementation, not the actual nested joins. I believe the link you provided is about actual nested join implementation 

Thank You,
Regards, 
Pradeepa

Evgenij Ryazanov

unread,
Feb 16, 2021, 1:38:42 AM2/16/21
to H2 Database
Why you think that this method is only about nested joins? It iterates over tables or subqueries, including joined and nested ones (if there are any) and their table filters do the same recursively. Index conditions are used when possible to avoid iteration over the whole tables. They are created by search and join conditions and query optimizer tries to choose the best execution plan with taking existing indexes and their selectivity into account. Only the usable index conditions are preserved. All these operations are performed before the actual query execution and cursors process conditions by themselves, so TableFilter.next() is a relatively simple method. Sorry, but you need to understand how it works by yourself.

Usually it's better to start from some trivial or at least simple enough tasks to get some initial knowledge about the product you want to improve, but you may have own reasons.

impradee

unread,
Feb 16, 2021, 7:47:20 AM2/16/21
to H2 Database
 Hi Evgenij,

Actually, I was initially exploring apache derby and came across different join methods which are Nested loop join, hash join and merge join. Derby has implemented their join strategy as an interface which represents the aforementioned approaches which the optimizer may pick for joining tables. However, I couldn't find such implementation in H2.  I am referring to join methods (i.e. nested loop, hash, block nested loop, merge etc) not join types (i.e. inner, outer, left etc).

Thank You
Regards

Noel Grandin

unread,
Feb 16, 2021, 8:09:19 AM2/16/21
to h2-da...@googlegroups.com
We don't have such other join strategies so we don't need any interfaces, so we just implement the join directly in code.

That code that we pointed at, is in fact the join code.

impradee

unread,
Feb 16, 2021, 8:15:48 AM2/16/21
to H2 Database
Hi Noel Grandin, 

Thank You very much for the reply. 

Reply all
Reply to author
Forward
0 new messages