From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | tubadzin <tubadzin(at)o2(dot)pl> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Adding Zigzag Merge Join to Index Nested Loops Join |
Date: | 2013-07-25 21:42:03 |
Message-ID: | CAMkU=1wZKvDdpHAP1ckw-wnrbym5-2NDTcEbVPsa-unAiq+wmw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Jul 23, 2013 at 12:40 PM, tubadzin <tubadzin(at)o2(dot)pl> 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
From | Date | Subject | |
---|---|---|---|
Next Message | didier | 2013-07-25 22:02:48 | Re: Design proposal: fsync absorb linear slider |
Previous Message | Alvaro Herrera | 2013-07-25 21:11:07 | Re: install libpq.dll in bin directory on Windows / Cygwin |