Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Denis Papathanasiou <denis.papathanasiou@xxxxxxxxx> writes:
> alerts=> CREATE INDEX node_val_tsv_idx ON node USING 
> gin(to_tsvector('english', val));
> CREATE INDEX
> alerts=> explain analyze select item_pk from node where 
> tag='primaryIssuer.entityType' and val @@ plainto_tsquery('Limited 
> Partnership');
> [ doesn't use the index ]

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');

Note that seeing that the scan on the other index is pretty cheap,
it's not obvious that indexing the @@ clause is better anyway.
But it *can't* index this query using this index.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux