Re: encourging bitmap AND

От: Tom Lane
Тема: Re: encourging bitmap AND
Дата: ,
Msg-id: 27812.1293137532@sss.pgh.pa.us
(см: обсуждение, исходный текст)
Ответ на: encourging bitmap AND  (Ben)
Ответы: Re: encourging bitmap AND  (Ben)
Re: encourging bitmap AND  (Marti Raudsepp)
Список: pgsql-performance

Скрыть дерево обсуждения

encourging bitmap AND  (Ben, )
 Re: encourging bitmap AND  (Tom Lane, )
  Re: encourging bitmap AND  (Ben, )
  Re: encourging bitmap AND  (Marti Raudsepp, )
   Re: encourging bitmap AND  (Tom Lane, )
    Re: encourging bitmap AND  (Jim Nasby, )

Ben <> writes:
> i have a schema similar to the following

> create index foo_s_idx on foo using btree (s);
> create index foo_e_idx on foo using btree (e);

> i want to do queries like

> select * from foo where 150 between s and e;

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.

I'd suggest setting up something involving a gist index over an
interval-ish datatype.  The PERIOD datatype that Jeff Davis is fooling
with would do what you want --- see
     http://pgfoundry.org/projects/temporal
     http://thoughts.j-davis.com/2009/11/08/temporal-keys-part-2/
If you don't want any add-on parts involved, you could fake it by using
a box or possibly lseg.

            regards, tom lane


В списке pgsql-performance по дате сообщения:

От: Josh Berkus
Дата:
Сообщение: Re: concurrent IO in postgres?
От: "Pierre C"
Дата:
Сообщение: Re: concurrent IO in postgres?