Re: Using GIN/Gist to search the "union" of two indexes?

Поиск
Список
Период
Сортировка
От Dimitri Fontaine
Тема Re: Using GIN/Gist to search the "union" of two indexes?
Дата
Msg-id m2vdd9dvio.fsf@hi-media.com
обсуждение исходный текст
Ответ на Using GIN/Gist to search the "union" of two indexes?  (Jesper Krogh <jesper@krogh.cc>)
Список pgsql-hackers
Jesper Krogh <jesper@krogh.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Mark Kirkwood
Дата:
Сообщение: Re: SQL compatibility reminder: MySQL vs PostgreSQL
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: SQL compatibility reminder: MySQL vs PostgreSQL