Fulltext - multiple single column indexes

From: esemba <esemba(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Fulltext - multiple single column indexes
Date: 2009-03-19 23:58:09
Message-ID: 22611952.post@talk.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John Cheng 2009-03-20 00:09:34 Re: Is there a meaningful benchmark?
Previous Message Alvaro Herrera 2009-03-19 23:42:36 Re: Special charaters