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

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index?
Дата
Msg-id
25605.1282772060@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? Denis Papathanasiou <denis.papathanasiou@gmail.com>
Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? Tom Lane <tgl@sss.pgh.pa.us>
Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? Denis Papathanasiou <denis.papathanasiou@gmail.com>
Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? Oleg Bartunov <oleg@sai.msu.su>
Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? Denis Papathanasiou <denis.papathanasiou@gmail.com>
Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? Tom Lane <tgl@sss.pgh.pa.us>
Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? Denis Papathanasiou <denis.papathanasiou@gmail.com>
Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? Tom Lane <tgl@sss.pgh.pa.us>
Re: Differences between to_tsquery() and plainto_tsquery() when it comes to applying an index? Oleg Bartunov <oleg@sai.msu.su>
Denis Papathanasiou  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
В списке pgsql-general по дате отправления
От: Oleg Bartunov
Дата:
От: Bill Christensen
Дата:
Сообщение: Re: Problem with dumps
FAQ