Re: Full text search - query plan? PG 8.4.1 - Mailing list pgsql-performance

From Jesper Krogh
Subject Re: Full text search - query plan? PG 8.4.1
Date
Msg-id 4AE5D7CC.202@krogh.cc
Whole thread Raw
In response to Re: Full text search - query plan? PG 8.4.1  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Full text search - query plan? PG 8.4.1
List pgsql-performance
Tom Lane wrote:
> Jesper Krogh <jesper@krogh.cc> writes:
>> Is is possible to manually set the cost for the @@ operator?
>
> You want to set the cost for the underlying function.

alter function ts_match_vq(tsvector,tsquery) cost 500

seems to change my test-queries in a very positive way (e.g. resolve to
bitmap index scan on most queryies but fall onto index-scans on
alternative columns when queriterms are common enough).

According to the documentation the default cost is 1 for builin
functions and 100 for others, is this true for the ts-stuff also?
Can I query the database for the cost of the functions?

It somehow seems natural that comparing a 1,3 term tsquery to a 200+
term tsvector is orders of magitude more expensive than simple operations.

I somehow suspect that this is a bad thing to do if I have other
gin-indexes where the tsvector is much smaller in the same database. But
then I can just use ts_match_qv for those queries or add my own which
justy raises the cost.

Thanks.

--
Jesper

pgsql-performance by date:

Previous
From: Michal J. Kubski
Date:
Subject: Re: query planning different in plpgsql?
Next
From: Tom Lane
Date:
Subject: Re: Full text search - query plan? PG 8.4.1