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
Re: Using bitmap index scans-more efficient |
| Список | 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 по дате отправления: