| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Denis Papathanasiou <denis(dot)papathanasiou(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org, 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-25 21:34:20 |
| Message-ID: | 25605.1282772060@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Denis Papathanasiou <denis(dot)papathanasiou(at)gmail(dot)com> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | PMC OS | 2010-08-25 22:05:58 | Re: How to setup PostgreSQL to work with libpam-pgsql/libnss-pgsql2? |
| Previous Message | Oleg Bartunov | 2010-08-25 21:17:34 | Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? |