Adding Zigzag Merge Join to Index Nested Loops Join
Adding Zigzag Merge Join to Index Nested Loops Join
От:
tubadzin <tubadzin@o2.pl>
Дата:
Hi.
I want add Zigzag Merge join to Index Nested Loops Join alghoritm.
http://www.cs.berkeley.edu/~fox/summaries/database/query_eval_5-8.html
Which files are responsible for Index nested loops join ? (not simple nested loops join which has double foreach in nodeNestloop.c) nodeIndexscan.c? nodeIndexonlyscan.c?
Best Regards
Tom
I want add Zigzag Merge join to Index Nested Loops Join alghoritm.
http://www.cs.berkeley.edu/~fox/summaries/database/query_eval_5-8.html
Which files are responsible for Index nested loops join ? (not simple nested loops join which has double foreach in nodeNestloop.c) nodeIndexscan.c? nodeIndexonlyscan.c?
Best Regards
Tom
Re: Adding Zigzag Merge Join to Index Nested Loops Join
От:
Robert Haas <robertmhaas@gmail.com>
Дата:
On Tue, Jul 23, 2013 at 3:40 PM, tubadzin wrote: > I want add Zigzag Merge join to Index Nested Loops Join alghoritm. > http://www.cs.berkeley.edu/~fox/summaries/database/query_eval_5-8.html > Which files are responsible for Index nested loops join ? (not simple nested > loops join which has double foreach in nodeNestloop.c) nodeIndexscan.c? > nodeIndexonlyscan.c? > Best Regards nodeNestloop.c handles all execution of all nested loops, regardless of whether there's an index scan involved. Of course, if there is an index scan involved, then nodeIndexscan.c will also be involved; if there is an index-only scan, then nodeIndexonlyscan.c, and so on. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Re: Adding Zigzag Merge Join to Index Nested Loops Join
От:
Jeff Janes <jeff.janes@gmail.com>
Дата:
On Tue, Jul 23, 2013 at 12:40 PM, tubadzin wrote:
> Hi.
> I want add Zigzag Merge join to Index Nested Loops Join alghoritm.
> http://www.cs.berkeley.edu/~fox/summaries/database/query_eval_5-8.html
> Which files are responsible for Index nested loops join ? (not simple nested
> loops join which has double foreach in nodeNestloop.c) nodeIndexscan.c?
> nodeIndexonlyscan.c?
> Best Regards
> Tom
As far as I can tell, a "zigzag merge" is nothing more than a nested
loop which uses an index scan on both the inner and outer. It seems a
bit strange to me to draw a box around that particular combination and
give it a specific name.
If that is what it really is, then there is nothing to implement.
PostgreSQL already does that when it thinks it is faster than the
alternatives.
pgbench -i -s10
set enable_seqscan TO off;
set enable_mergejoin TO off;
set enable_hashjoin TO off;
explain select * from pgbench_accounts join pgbench_branches using
(bid) where aid between 1 and 5;
QUERY PLAN
------------------------------------------------------------------------------------------------------Nested Loop (cost=0.58..25.21 rows=4 width=457) -> Index Scan using pgbench_accounts_pkey on pgbench_accounts
(cost=0.43..8.51 rows=4 width=97) Index Cond: ((aid >= 1) AND (aid <= 5)) -> Index Scan using pgbench_branches_pkey on pgbench_branches
(cost=0.14..4.16 rows=1 width=364) Index Cond: (bid = pgbench_accounts.bid)
Cheers,
Jeff