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

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

From
tgl@postgresql.org (Tom Lane)
Date:
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)