pgsql: Fix an oversight in the 8.2 patch that improved mergejoin

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix an oversight in the 8.2 patch that improved mergejoin
Date: 2008-09-05 21:07:29
Message-ID: 20080905210729.70E79755325@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Log Message:
-----------
Fix an oversight in the 8.2 patch that improved mergejoin performance by
inserting a materialize node above an inner-side sort node, when the sort is
expected to spill to disk. (The materialize protects the sort from having
to support mark/restore, allowing it to do its final merge pass on-the-fly.)
We neglected to teach cost_mergejoin about that hack, so it was failing to
include the materialize's costs in the estimated cost of the mergejoin.
The materialize's costs are generally going to be pretty negligible in
comparison to the sort's, so this is only a small error and probably not
worth back-patching; but it's still wrong.

In the similar case where a materialize is inserted to protect an inner-side
node that can't do mark/restore at all, it's still true that the materialize
should not spill to disk, and so we should cost it cheaply rather than
expensively.

Noted while thinking about a question from Tom Raney.

Modified Files:
--------------
pgsql/src/backend/optimizer/path:
costsize.c (r1.196 -> r1.197)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/costsize.c?r1=1.196&r2=1.197)
pgsql/src/backend/optimizer/plan:
createplan.c (r1.247 -> r1.248)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/createplan.c?r1=1.247&r2=1.248)
pgsql/src/backend/optimizer/util:
pathnode.c (r1.146 -> r1.147)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/pathnode.c?r1=1.146&r2=1.147)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2008-09-05 23:53:42 pgsql: Add comment about why pg_dump doesn't dump the public schema
Previous Message Peter Eisentraut 2008-09-05 18:54:58 pgsql: Check for gcov and lcov only when coverage testing is enabled.

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-09-05 21:09:44 Re: Proposal: new border setting in psql
Previous Message Alvaro Herrera 2008-09-05 21:01:08 Re: Need more reviewers!