Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? - Mailing list pgsql-general

From Denis Papathanasiou
Subject Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?
Date
Msg-id 4C76A2B1.2050908@gmail.com
Whole thread Raw
In response to Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?
List 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?

pgsql-general by date:

Previous
From: "Michael P. Soulier"
Date:
Subject: Re: looping on NEW and OLD in a trigger
Next
From: Tom Lane
Date:
Subject: Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?