pgsql: Arrange to cache the results of looking up a btree predicate

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Arrange to cache the results of looking up a btree predicate
Date: 2008-11-13 00:20:45
Message-ID: 20081113002045.AB8F27545A4@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Arrange to cache the results of looking up a btree predicate proof comparison
operator. The result depends only on the two input operators and the proof
direction (imply or refute), so it's easy to cache. This provides a very
large savings in cases such as Sergey Konoplev's long NOT-IN-list example,
where predtest spends all its time repeatedly figuring out that the same pair
of operators cannot be used to prove anything. (But of course the O(N^2)
behavior still catches up with you eventually.) I'm not convinced it buys
a whole lot when constraint_exclusion isn't turned on, but it's not a lot
of added code so we might as well cache all the time.

Modified Files:
--------------
pgsql/src/backend/optimizer/util:
predtest.c (r1.21 -> r1.22)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/predtest.c?r1=1.21&r2=1.22)

Browse pgsql-committers by date

  From Date Subject
Next Message User Itagaki 2008-11-13 01:49:22 orafce - orafce: Cleanup white spaces and indentations.
Previous Message Tom Lane 2008-11-12 23:08:55 pgsql: In predtest.c, install a limit on the number of branches we will