I have a query:
SELECT oh.idFROM objects_hier ohwhereoh.id < 2000 (!)andoh.id in ( SELECT id as id FROM objects_access oa WHERE oa.master IN (1,2,10001) AND oa.id < 2000 (!)
)
The sense of the query is simple: I choose ids from
objects_hier where access has
explain analyze select * from objects_hier where tg
&& array[0] and id <1;
Bitmap Heap Scan on objects_hier
(cost=4.79..8.80 rows=1 width=337) (actual time=0.110..0.110 rows=0 loops=1)
Recheck Cond: ((tg &&
'{0}'::integer[]) AND (id < 1))
-> BitmapAnd
(cost=4.79..4.79
I tried to use intarray on 8.1 . It seems to give
same estimates for anything I ask:
explain analyze select * from objects_hier where tg &&
array[10001]
explain analyze select * from objects_hier where tg &&
array[0]
explain analyze select * from objects_hier where tg @
array[10001]
Hello,
I have a request like SELECT ... WHERE x<=A<=y AND t<=B<=u AND z<=C<=w AND ..
5 columns are in BETWEEN clauses.
What is the best index I could use?
If I create btree index on all columns (A,B,C..), here is what explain
analyze gives me: