Fulltext - multiple single column indexes - Mailing list pgsql-general

From esemba
Subject Fulltext - multiple single column indexes
Date
Msg-id 22611952.post@talk.nabble.com
Whole thread Raw
Responses Re: Fulltext - multiple single column indexes  (Richard Huxton <dev@archonet.com>)
Re: Fulltext - multiple single column indexes  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-general
Hi,
I have table with several columns and need to perform fulltext search over
volatile number of columns.
I can't use multicolumn gist index or gin index over concatenated columns,
so I've created several single column indexes (one for each column I want to
search) and now I need to query them like this:

to_tsvector('cs', coalesce(annotation, '')) || to_tsvector('cs',
coalesce(resume, '')) || ...
@@ to_tsquery('cs', 'Query text');

This query works, but EXPLAIN has shown me, that postgres doesn't use the
indexes, so the query over a table with several thousands of records last
very long time. I've figured out, that indexes probably cannot be used this
way. What is a recommendation for this scenario?
Indexes over static number of columns work fine, but I can't use them,
because in my application logic I want to let user choose which columns to
search.

Thank you for your reply.
--
View this message in context: http://www.nabble.com/Fulltext---multiple-single-column-indexes-tp22611952p22611952.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Special charaters
Next
From: ries van Twisk
Date:
Subject: Re: Is there a meaningful benchmark?