Re: Using bitmap index scans-more efficient

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Using bitmap index scans-more efficient
Дата
Msg-id 27367.1155606817@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Using bitmap index scans-more efficient  (Kyle Bateman <kyle@actarg.com>)
Ответы Re: Using bitmap index scans-more efficient  (Kyle Bateman <kyle@actarg.com>)
Re: Using bitmap index scans-more efficient  (Kyle Bateman <kyle@actarg.com>)
Список pgsql-sql
Kyle Bateman <kyle@actarg.com> writes:
> But I'm assuming that using an interval-encoded project tree, I would 
> have to do something like the following to get a progency group:

> select * from ledger l, proj p where p.proj_id = l.proj and p.left > 
> 1234 and p.right < 2345;

btree has no idea about the constraint (that I imagine exists) that left
<= right.  If you're just doing a simple index on (left, right) then the
above query requires scanning all index entries with left > 1234.  It
would probably help to say

select * from ledger l, proj p where p.proj_id = l.proj and p.left > 1234 and p.left < 2345 and p.right < 2345;

so that you can constrain the range of "left" values scanned.
        regards, tom lane


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

Предыдущее
От: Kyle Bateman
Дата:
Сообщение: Re: Using bitmap index scans-more efficient
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Multiple DB join