Re: Hstore index for full text search

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Hstore index for full text search
Дата
Msg-id 71100.1597188658@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Hstore index for full text search  (Michael Lewis <mlewis@entrata.com>)
Список pgsql-performance
Michael Lewis <mlewis@entrata.com> writes:
> On Tue, Aug 11, 2020 at 4:46 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Another point is that you will only
>> get an indexscan if *every* OR'd clause matches some index.  The example
>> query looks sufficiently unstructured that that might be hard to ensure.

> Does this still apply when the where clauses are on several tables and not
> just one?

Yeah.  In that case there's no hope of an indexscan at all, since for all
the planner knows, the query might match some table rows that don't meet
any of the conditions mentioned for that table's columns.  If you can
write

WHERE (condition-on-t1.a OR condition-on-t1.b OR ...)
  AND (condition-on-t2.x OR condition-on-t2.y OR ...)

then you've got a chance of making the OR'd conditions into index
qualifications on t1 or t2 respectively.  But if it's

WHERE condition-on-t1.a OR condition-on-t1.b OR ...
   OR condition-on-t2.x OR condition-on-t2.y OR ...

then you're in for full-table scans.  (This is another thing that
was bothering me about the data design, though I failed to think
it through clearly enough to state before.)

            regards, tom lane



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

Предыдущее
От: Jim Jarvie
Дата:
Сообщение: Re: Is there a known bug with SKIP LOCKED and "tuple to be locked was already moved to another partition due to concurrent update"?
Следующее
От: Ken Tanzer
Дата:
Сообщение: Query takes way longer with LIMIT, and EXPLAIN takes way longer than actual query