Re: Full text search - query plan? PG 8.4.1

From: Jesper Krogh <jesper(at)krogh(dot)cc>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Full text search - query plan? PG 8.4.1
Date: 2009-10-26 17:09:32
Message-ID: 4AE5D7CC.202@krogh.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Tom Lane wrote:
> Jesper Krogh <jesper(at)krogh(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2009-10-26 17:31:01 Re: Full text search - query plan? PG 8.4.1
Previous Message Michal J. Kubski 2009-10-26 13:50:00 Re: query planning different in plpgsql?