Re: encourging bitmap AND

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: encourging bitmap AND
Дата
Msg-id 17713.1293384287@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: encourging bitmap AND  (Marti Raudsepp <marti@juffo.org>)
Ответы Re: encourging bitmap AND  (Jim Nasby <jim@nasby.net>)
Список pgsql-performance
Marti Raudsepp <marti@juffo.org> writes:
> On Thu, Dec 23, 2010 at 22:52, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> That index structure is really entirely unsuited to what you want to do,
>> so it's not surprising that the planner isn't impressed with the idea of
>> a bitmap AND.

> Why is it unsuited for this query? It expands to (150 < s AND 150 > e)
>  which should work nicely with bitmap AND as far as I can tell.

Well, maybe for small values of "nicely".  If you do it like that, then
on average each indexscan will scan about half of its index and return a
bitmap representing about half the rows in the table.  That's an
expensive indexscan, and an expensive bitmap-AND operation, even if the
final number of rows out of the AND is small.  Plus you're at serious
risk that the bitmaps will become lossy, which degrades the performance
of the final bitmap heapscan.

If you're doing interval queries enough to worry about having an index
for them, you really want an indexing structure that is designed to do
interval queries efficiently.

            regards, tom lane

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

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: concurrent IO in postgres?
Следующее
От: "marc.hsiao"
Дата:
Сообщение: How to turn autovacuum prevent wrap around run faster?