Arrange to cache the results of looking up a btree predicate proof comparison
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 13 Nov 2008 00:20:45 +0000 (00:20 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 13 Nov 2008 00:20:45 +0000 (00:20 +0000)
commite7d8bfb9342622971cfb326672c998934433546a
tree08d4b5b6d63fd1ea562b34892dff1e29194cd713
parentfdf8d0624a9881e8ff6efcd60e20290291cc4c6c
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.
src/backend/optimizer/util/predtest.c