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:28
Message-ID: 20090416204228.579317540E2@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.

Tags:
----
REL8_3_STABLE

Modified Files:
--------------
pgsql/src/backend/nodes:
copyfuncs.c (r1.388 -> r1.388.2.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/copyfuncs.c?r1=1.388&r2=1.388.2.1)
equalfuncs.c (r1.318 -> r1.318.2.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/equalfuncs.c?r1=1.318&r2=1.318.2.1)
outfuncs.c (r1.322.2.1 -> r1.322.2.2)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/outfuncs.c?r1=1.322.2.1&r2=1.322.2.2)
pgsql/src/backend/optimizer/path:
indxpath.c (r1.227.2.1 -> r1.227.2.2)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/indxpath.c?r1=1.227.2.1&r2=1.227.2.2)
orindxpath.c (r1.84 -> r1.84.2.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/orindxpath.c?r1=1.84&r2=1.84.2.1)
pgsql/src/backend/optimizer/plan:
initsplan.c (r1.138.2.2 -> r1.138.2.3)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/initsplan.c?r1=1.138.2.2&r2=1.138.2.3)
pgsql/src/backend/optimizer/util:
restrictinfo.c (r1.55 -> r1.55.2.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/restrictinfo.c?r1=1.55&r2=1.55.2.1)
pgsql/src/include/nodes:
relation.h (r1.154.2.3 -> r1.154.2.4)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/relation.h?r1=1.154.2.3&r2=1.154.2.4)
pgsql/src/include/optimizer:
restrictinfo.h (r1.41 -> r1.41.2.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/restrictinfo.h?r1=1.41&r2=1.41.2.1)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2009-04-17 15:33:33 pgsql: Bump disable_cost up from 1e8 to 1e10, per gripe from Kris Jurka.
Previous Message Tom Lane 2009-04-16 20:42:17 pgsql: Fix planner to restore its previous level of intelligence about