Re: Index problem.... GIST (tsearch2)

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Index problem.... GIST (tsearch2)
Дата
Msg-id 87ekka6qsq.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Index problem.... GIST (tsearch2)  ("Net Virtual Mailing Lists" <mailinglists@net-virtual.com>)
Ответы Re: Index problem.... GIST (tsearch2)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
"Net Virtual Mailing Lists" <mailinglists@net-virtual.com> writes:

> SELECT * from sometable WHERE is_null(category1)='f' AND data_fti @@
> to_tsquery('default', 'postgres');
>
> How can I make this query first use the is_null index?... It strikes me
> that this would almost always be faster then doing the full-text search
> first, right?...

Well that depends on how many are false versus how many the full-text search
finds.

In this circumstance postgres is trying to compare two unknowns. It doesn't
know how often is_nul() is going to return false, and it doesn't know how many
records the full text search will match.

8.0 will have statistics on how often is_null() will return false. But that
isn't really going to solve your problem since it still won't have any idea
how many rows the full text search will find.

I don't even know of anything you can do to influence the selectivity
estimates of the full text search.

--
greg

В списке pgsql-general по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: regular expression searches
Следующее
От: "Kiarash Bodouhi"
Дата:
Сообщение: Question from a newbie