postgresql/src/backend/tsearch
Tom Lane 1faf866ace 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:20 -04:00
..
dict.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
dict_ispell.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
dict_simple.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
dict_synonym.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
dict_thesaurus.c Remove unreachable code 2012-07-16 22:15:03 +03:00
hunspell_sample.affix Add regression tests for ispell, synonym and thesaurus dictionaries. 2007-09-11 11:54:42 +00:00
ispell_sample.affix Add regression tests for ispell, synonym and thesaurus dictionaries. 2007-09-11 11:54:42 +00:00
ispell_sample.dict Add regression tests for ispell, synonym and thesaurus dictionaries. 2007-09-11 11:54:42 +00:00
Makefile Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
regis.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
spell.c Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
synonym_sample.syn Add prefix support for synonym dictionary 2009-08-14 14:53:20 +00:00
thesaurus_sample.ths Remove extra newlines at end and beginning of files, add missing newlines 2010-08-19 05:57:36 +00:00
to_tsany.c Replace int2/int4 in C code with int16/int32 2012-06-25 01:51:46 +03:00
ts_locale.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
ts_parse.c Replace int2/int4 in C code with int16/int32 2012-06-25 01:51:46 +03:00
ts_selfuncs.c Fix logical errors in tsquery selectivity estimation for prefix queries. 2012-09-11 21:23:20 -04:00
ts_typanalyze.c Reduce hash size for compute_array_stats, compute_tsvector_stats. 2012-04-23 22:05:41 -04:00
ts_utils.c Make new event trigger facility actually do something. 2012-07-20 11:39:01 -04:00
wparser.c Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
wparser_def.c Replace int2/int4 in C code with int16/int32 2012-06-25 01:51:46 +03:00