Re: Indexing queries with bit masks

Поиск
Список
Период
Сортировка
От Peter Hunsberger
Тема Re: Indexing queries with bit masks
Дата
Msg-id t2xcc159a4a1004301015p621cc791n4fa2ec14cbfbd93a@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Indexing queries with bit masks  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Fri, Apr 30, 2010 at 11:29 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Peter Hunsberger <peter.hunsberger@gmail.com> writes:
>> If all subscriptions are roughly equal in popularity then any single
>> select should give ~ 10% of the data.  That would seem to be selective
>> enough that you'd really want an index?
>
> My personal rule of thumb is that 10% is around the threshold where
> indexes stop being very helpful.  At that selectivity, you're going
> to be having to read every page of the table anyway, and it's not
> clear that the extra I/O to read the index is going to get repaid in
> CPU savings.  (Now if the table+index are fully cached in RAM, the
> threshold's probably a bit higher, but there still is not reason to
> think that an index is going to make for a huge improvement.)
>
>> If so, any answers to the OP's main question; what would be the most
>> efficient way to handle this type of thing?

Ok, that makes sense, which immediately makes me wonder if partitions
might make sense for this use case?  In particular if there really are
only 10 different types?

[...]

> The best idea that comes to mind offhand is to not use an integer, but a
> boolean array, such that the queries look like
>
>        select ... where subscriptions[4];
>

Interesting idea.  That might be worth testing for some of my use cases....

--
Peter Hunsberger

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

Предыдущее
От: Geoffrey
Дата:
Сообщение: temp tables
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: temp tables