pgsql: Fix planner to restore its previous level of intelligence about

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix planner to restore its previous level of intelligence about
Date: 2009-04-16 20:42:17
Message-ID: 20090416204217.038757540E2@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Fix planner to restore its previous level of intelligence about pushing
constants through full joins, as in

select * from tenk1 a full join tenk1 b using (unique1)
where unique1 = 42;

which should generate a fairly cheap plan where we apply the constraint
unique1 = 42 in each relation scan. This had been broken by my patch of
2008-06-27, which is now reverted in favor of a more invasive but hopefully
less incorrect approach. That patch was meant to prevent incorrect extraction
of OR'd indexclauses from OR conditions above an outer join. To do that
correctly we need more information than the outerjoin_delay flag can provide,
so add a nullable_relids field to RestrictInfo that records exactly which
relations are nulled by outer joins that are underneath a particular qual
clause. A side benefit is that we can make the test in create_or_index_quals
more specific: it is now smart enough to extract an OR'd indexclause into the
outer side of an outer join, even though it must not do so in the inner side.
The old coding couldn't distinguish these cases so it could not do either.

Modified Files:
--------------
pgsql/src/backend/nodes:
copyfuncs.c (r1.429 -> r1.430)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/copyfuncs.c?r1=1.429&r2=1.430)
equalfuncs.c (r1.352 -> r1.353)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/equalfuncs.c?r1=1.352&r2=1.353)
outfuncs.c (r1.358 -> r1.359)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/outfuncs.c?r1=1.358&r2=1.359)
pgsql/src/backend/optimizer/path:
indxpath.c (r1.238 -> r1.239)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/indxpath.c?r1=1.238&r2=1.239)
orindxpath.c (r1.88 -> r1.89)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/orindxpath.c?r1=1.88&r2=1.89)
pgsql/src/backend/optimizer/plan:
initsplan.c (r1.149 -> r1.150)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/initsplan.c?r1=1.149&r2=1.150)
pgsql/src/backend/optimizer/util:
restrictinfo.c (r1.57 -> r1.58)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/restrictinfo.c?r1=1.57&r2=1.58)
pgsql/src/include/nodes:
relation.h (r1.171 -> r1.172)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/relation.h?r1=1.171&r2=1.172)
pgsql/src/include/optimizer:
restrictinfo.h (r1.42 -> r1.43)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/restrictinfo.h?r1=1.42&r2=1.43)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2009-04-16 20:42:28 pgsql: Fix planner to restore its previous level of intelligence about
Previous Message Alvaro Herrera 2009-04-16 14:43:39 pgsql: Fix the regression test error message for array_fill, too.