Here is a trouble I am having, that looks like a bug to me:

create table abc (a int, b int, c int);
create index abc_idx on abc (a,b,c);
set enable_seqscan=off;

explain select * from abc where a in (1,2,3);

QUERY PLAN ------------------------------------------------------------------------
-------
Index Scan using abc_idx, abc_idx on abc (cost=0.00..34.16 rows=10 width=12)
Index Cond: ((a = 1) OR (a = 2))
(2 rows)


Looks great - just what I expect, *but*:

explain select * from abc where a=1 and b in (1,2);

QUERY PLAN ---------------------------------------------------------------------
Index Scan using abc_idx on abc (cost=0.00..17.09 rows=1 width=12)
Index Cond: (a = 1)
Filter: ((b = 1) OR (b = 2))



Now, why doesn't it want to use the index for the second condition??? Any ideas?

Thanks a lot!

Dima



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to