From: | Dimitri Fontaine <dfontaine(at)hi-media(dot)com> |
---|---|
To: | Jesper Krogh <jesper(at)krogh(dot)cc> |
Cc: | PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Using GIN/Gist to search the "union" of two indexes? |
Date: | 2010-03-06 20:50:55 |
Message-ID: | m2vdd9dvio.fsf@hi-media.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Jesper Krogh <jesper(at)krogh(dot)cc> writes:
> select id from tablea,tableb where tablea.tableb_id = tableb.id and
> tablea.text @@ to_tsquery('ftsquery') or tableb.text @@
> to_tsquery('ftsquery');
>
> This one is doable .. using some "mocking" of queries in the
> application. But if ftsquery is:
>
> "terma & termb" where terma only exists in tablea and termb only exists
> in tableb, then it doesn't work. The path would seem to be to "not use"
> the indexes.
You probably could maintain a separate "materialized" table with a
single tsvector for the two input tables, then query that vector
alone. Given the right foreign keys or copied data you'll get the
matched data easily too.
Hope this helps, regards,
--
dim
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2010-03-06 21:01:06 | Re: SQL compatibility reminder: MySQL vs PostgreSQL |
Previous Message | Mark Kirkwood | 2010-03-06 20:48:50 | Re: SQL compatibility reminder: MySQL vs PostgreSQL |