Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?

From: Denis Papathanasiou <denis(dot)papathanasiou(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
Subject: Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?
Date: 2010-08-26 17:21:53
Message-ID: 4C76A2B1.2050908@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> That index doesn't match the query, so it can't be used. Try
>
> select item_pk from node where
> tag='primaryIssuer.entityType' and
> to_tsvector('english', val) @@ plainto_tsquery('Limited Partnership');

Tom and Oleg: thank you for clarifying this.

I see where I made the mistake in applying the example from the
documentation.

> Note that seeing that the scan on the other index is pretty cheap,
> it's not obvious that indexing the @@ clause is better anyway.

So is it the case that, as in the documented example, I need to add a
column of type ts_vector to the table for the index to be most effective?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-08-26 17:27:23 Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?
Previous Message Michael P. Soulier 2010-08-26 16:59:16 Re: looping on NEW and OLD in a trigger