Dmitry Tkach writes: > 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???
It can only use all columns of a multicolumn index if the columns are used in clauses connected by OR. This is described in the documentation. -- Peter Eisentraut [EMAIL PROTECTED] ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html