pgsql: Tweak tsmatchsel() so that it examines the structure of the

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Tweak tsmatchsel() so that it examines the structure of the
Date: 2010-07-31 03:27:57
Message-ID: 20100731032757.71F437541D5@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Tweak tsmatchsel() so that it examines the structure of the tsquery whenever
possible (ie, whenever the tsquery is a constant), even when no statistics
are available for the tsvector. For example, foo @@ 'a & b'::tsquery
can be expected to be more selective than foo @@ 'a'::tsquery, whether
or not we know anything about foo. We use DEFAULT_TS_MATCH_SEL as the assumed
selectivity of individual query terms when no stats are available, then
combine the terms according to the query's AND/OR structure as usual.

Per experimentation with Artur Dabrowski's example. (The fact that there
are no stats available in that example is a problem in itself, but
nonetheless tsmatchsel should be smarter about the case.)

Back-patch to 8.4 to keep all versions of tsmatchsel() in sync.

Tags:
----
REL8_4_STABLE

Modified Files:
--------------
pgsql/src/backend/tsearch:
ts_selfuncs.c (r1.4 -> r1.4.2.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/tsearch/ts_selfuncs.c?r1=1.4&r2=1.4.2.1)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2010-08-01 01:08:30 pgsql: Make psql distinguish between unique indices and unique
Previous Message Tom Lane 2010-07-31 03:27:49 pgsql: Tweak tsmatchsel() so that it examines the structure of the