pgsql: Performance fix for new anti-join code in nodeMergejoin.c: after

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Performance fix for new anti-join code in nodeMergejoin.c: after
Date: 2008-08-15 19:20:42
Message-ID: 20080815192042.2B08E755315@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Performance fix for new anti-join code in nodeMergejoin.c: after finding a
match in antijoin mode, we should advance to next outer tuple not next inner.
We know we don't want to return this outer tuple, and there is no point in
advancing over matching inner tuples now, because we'd just have to do it
again if the next outer tuple has the same merge key. This makes a noticeable
difference if there are lots of duplicate keys in both inputs.

Similarly, after finding a match in semijoin mode, arrange to advance to
the next outer tuple after returning the current match; or immediately,
if it fails the extra quals. The rationale is the same. (This is a
performance bug in existing releases; perhaps worth back-patching? The
planner tries to avoid using mergejoin with lots of duplicates, so it may
not be a big issue in practice.)

Nestloop and hash got this right to start with, but I made some cosmetic
adjustments there to make the corresponding bits of logic look more similar.

Modified Files:
--------------
pgsql/src/backend/executor:
nodeHashjoin.c (r1.94 -> r1.95)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeHashjoin.c?r1=1.94&r2=1.95)
nodeMergejoin.c (r1.92 -> r1.93)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeMergejoin.c?r1=1.92&r2=1.93)
nodeNestloop.c (r1.47 -> r1.48)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeNestloop.c?r1=1.47&r2=1.48)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2008-08-16 00:01:38 pgsql: Clean up the loose ends in selectivity estimation left by my
Previous Message Dave Page 2008-08-15 15:27:28 stackbuilder - wizard: Remove extra bracket