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

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Index problem.... GIST (tsearch2)
Date: 2004-10-07 23:40:05
Message-ID: 87ekka6qsq.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


"Net Virtual Mailing Lists" <mailinglists(at)net-virtual(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kiarash Bodouhi 2004-10-07 23:44:27 Question from a newbie
Previous Message Gaetano Mendola 2004-10-07 23:34:29 Re: interfaces for python