postgresql/src
Tom Lane 8d3487dacc Rewrite the key-combination logic in GIN's keyGetItem() and scanGetItem()
routines to make them behave better in the presence of "lossy" index pointers.
The previous coding was outright incorrect for some cases, as recently
reported by Artur Dabrowski: scanGetItem would fail to return index entries in
cases where one index key had multiple exact pointers on the same page as
another key had a lossy pointer.  Also, keyGetItem was extremely inefficient
for cases where a single index key generates multiple "entry" streams, such as
an @@ operator with a multiple-clause tsquery.  The presence of a lossy page
pointer in any one stream defeated its ability to use the opclass
consistentFn, resulting in probing many heap pages that didn't really need to
be visited.  In Artur's example case, a query like
	WHERE tsvector @@ to_tsquery('a & b')
was about 50X slower than the theoretically equivalent
	WHERE tsvector @@ to_tsquery('a') AND tsvector @@ to_tsquery('b')
The way that I chose to fix this was to have GIN call the consistentFn
twice with both TRUE and FALSE values for the in-doubt entry stream,
returning a hit if either call produces TRUE, but not if they both return
FALSE.  The code handles this for the case of a single in-doubt entry stream,
but punts (falling back to the stupid behavior) if there's more than one lossy
reference to the same page.  The idea could be scaled up to deal with multiple
lossy references, but I think that would probably be wasted complexity.  At
least to judge by Artur's example, such cases don't occur often enough to be
worth trying to optimize.

Back-patch to 8.4.  8.3 did not have lossy GIN index pointers, so not
subject to these problems.
2010-07-31 00:31:12 +00:00
..
backend Rewrite the key-combination logic in GIN's keyGetItem() and scanGetItem() 2010-07-31 00:31:12 +00:00
bin Fix several problems in pg_dump's handling of SQL/MED objects, notably failure 2010-07-14 21:21:23 +00:00
include Rewrite the key-combination logic in GIN's keyGetItem() and scanGetItem() 2010-07-31 00:31:12 +00:00
interfaces Allow full SSL certificate verification (wherein libpq checks its host name 2010-07-14 17:10:03 +00:00
makefiles Allow out-of-tree builds on mingw and cygwin 2009-01-05 09:27:20 +00:00
pl The previous fix in CVS HEAD and 8.4 for handling the case where a cursor 2010-07-05 09:27:24 +00:00
port Move copydir.c from src/port to src/backend/storage/file 2010-07-02 17:03:38 +00:00
template Tweak configure to attempt to add -qnoansialias to CFLAGS whenever running 2009-02-11 20:02:40 +00:00
test Fix potential failure when hashing the output of a subplan that produces 2010-07-28 04:51:08 +00:00
timezone Change the "N. Central Asia Standard Time" timezone to map to 2010-05-20 14:13:23 +00:00
tools Unbreak MSVC builds by removing copydir.c from list of libpgport files 2010-07-03 00:58:23 +00:00
tutorial Remove copyright mention of Andrew Yu, per author's permission. 2010-02-02 18:52:06 +00:00
bcc32.mak Remove old-style win32 client-only visual c++ build infrastructure for everything except 2007-03-05 14:18:38 +00:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Add the possibility to specify an explicit validator function for foreign-data 2009-02-24 10:06:36 +00:00
Makefile.global.in Fix the makefiles to fail cleanly if Perl is needed but not present. This 2009-06-23 03:46:00 +00:00
Makefile.shlib Allow out-of-tree builds on mingw and cygwin 2009-01-05 09:27:20 +00:00
nls-global.mk Do not msgmerge against /dev/null; merge against the pot file itself 2009-01-20 09:58:50 +00:00
win32.mak Update supported standalone VC++ version to 7.1+ only, and fix 2007-08-03 10:47:11 +00:00