Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause
Дата
Msg-id CAMkU=1wRD1UQEvLmDUciyujnhVKx7q792wCuUjCATBRHv2Tq7w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause  ("Madusudanan.B.N" <b.n.madusudanan@gmail.com>)
Список pgsql-performance
On Thu, Sep 22, 2016 at 6:37 AM, Madusudanan.B.N <b.n.madusudanan@gmail.com> wrote:
> However, this results in an awful slow plan (requiring to scan the complete big_table which obviously isn't optimal)

You mean to say there is a sequential scan ? An explain would be helpful. Are there indexes on the provided where clauses. 

Postgres can do a Bitmap heap scan to combine indexes, there is no need to fire two separate queries.

It can't combine bitmap scans that come from different tables.

But he can just combine the two queries into one, with a UNION.

Cheers,

Jeff

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

Предыдущее
От: Igor Neyman
Дата:
Сообщение: Re: Multiple-Table-Spanning Joins with ORs in WHERE Clause
Следующее
От: Tom Lane
Дата:
Сообщение: Re: query against single partition uses index, against master table does seq scan