encourging bitmap AND

Поиск
Список
Период
Сортировка
От Ben
Тема encourging bitmap AND
Дата
Msg-id 5297F6A0-AB39-49F1-80BB-8EE60F3E243E@gmail.com
обсуждение исходный текст
Ответы Re: encourging bitmap AND  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
hello --

i have a schema similar to the following

create table foo (
 id integer not null,
 val integer not null,
 s integer not null,
 e integer not null
);

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;

this usually gives me index or bitmap scans on one of the indices, plus a filter for the other condition.  this is not
terriblyefficient as the table is large (billions of rows), but there should only be a few thousand rows with s < k < e
forany k.  the data is id, value, interval (s, e), with s < e, and e - s is "small". 

i am experimenting and would like to see the effect of using a bitmap index "AND" scan using both indices.  as far as i
cantell, there are no easy ways to force or encourage this -- there are no switches like enable_seqscan and such which
forcethe use of bitmap AND, and i don't know how to tell the query planner about the structure of the data (i don't
thinkthis is adequately captured in any of the statistics it generates, i would need multi-column statistics.) 

any clues?

best regards, ben

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

Предыдущее
От: Andy
Дата:
Сообщение: Re: concurrent IO in postgres?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: encourging bitmap AND