postgresql/src
Tom Lane 31f1b2090f Fix logical errors in tsquery selectivity estimation for prefix queries.
I made multiple errors in commit 97532f7c29,
stemming mostly from failure to think about the available frequency data
as being element frequencies not value frequencies (so that occurrences of
different elements are not mutually exclusive).  This led to sillinesses
such as estimating that "word" would match more rows than "word:*".

The choice to clamp to a minimum estimate of DEFAULT_TS_MATCH_SEL also
seems pretty ill-considered in hindsight, as it would frequently result in
an estimate much larger than the available data suggests.  We do need some
sort of clamp, since a pattern not matching any of the MCELEMs probably
still needs a selectivity estimate of more than zero.  I chose instead to
clamp to at least what a non-MCELEM word would be estimated as, preserving
the property that "word:*" doesn't get an estimate less than plain "word",
whether or not the word appears in MCELEM.

Per investigation of a gripe from Bill Martin, though I suspect that his
example case actually isn't even reaching the erroneous code.

Back-patch to 9.1 where this code was introduced.
2012-09-11 21:23:39 -04:00
..
backend Fix logical errors in tsquery selectivity estimation for prefix queries. 2012-09-11 21:23:39 -04:00
bin Fix "too many arguments" messages not to index off the end of argv[]. 2012-09-06 15:52:19 -04:00
include Fix PARAM_EXEC assignment mechanism to be safe in the presence of WITH. 2012-09-07 20:38:28 -04:00
interfaces Use .NOTPARALLEL in ecpg/Makefile to avoid a gmake parallelism bug. 2012-09-09 15:09:04 -04:00
makefiles Remove BSD/OS (BSDi) port. There are no known users upgrading to 2012-05-03 10:58:44 -04:00
pl Make plperl safe against functions that are redefined while running. 2012-09-09 20:32:59 -04:00
port Improve reporting of error situations in find_other_exec(). 2012-07-27 19:31:19 -04:00
template Remove BSD/OS (BSDi) port. There are no known users upgrading to 2012-05-03 10:58:44 -04:00
test Fix PARAM_EXEC assignment mechanism to be safe in the presence of WITH. 2012-09-07 20:38:28 -04:00
timezone Update time zone data files to tzdata release 2012e. 2012-08-14 10:54:30 -04:00
tools Add vcregress.pl target for checking pg_upgrade. 2012-09-10 12:51:24 -04:00
tutorial Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02: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 Fix some oversights in distprep and maintainer-clean targets. 2011-03-10 00:04:05 -05:00
Makefile.global.in Fix pg_config.h make rule 2012-05-07 21:28:38 +03:00
Makefile.shlib Remove BSD/OS (BSDi) port. There are no known users upgrading to 2012-05-03 10:58:44 -04:00
nls-global.mk Lots of doc corrections. 2012-04-23 22:43:09 -04:00
win32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00