Jeff Davis <pgsql@xxxxxxxxxxx> writes: > I have two indexes defined on "syslog_p": > "syslog_p_severity_ts_idx" btree (severity, ts) > "syslog_p_ts_where_severity_1_idx" btree (ts) WHERE severity = 1 > The planner chooses what looks to me like a very strange plan for this > query: > => explain analyze select * from syslog where severity=1; The attached crude hack makes it not do that, but I wonder whether it won't prevent use of bitmap AND in some cases where we'd rather it did use an AND. Want to try it out? Possibly a more salient question is why are you bothering with two indexes defined like that. Now that I look closely, they seem pretty redundant. regards, tom lane Index: indxpath.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v retrieving revision 1.217 diff -c -r1.217 indxpath.c *** indxpath.c 17 Mar 2007 00:11:04 -0000 1.217 --- indxpath.c 19 Mar 2007 18:22:23 -0000 *************** *** 787,793 **** foreach(cell2, list2) { ! if (lfirst(cell2) == datum1) return true; } } --- 787,793 ---- foreach(cell2, list2) { ! if (equal(lfirst(cell2), datum1)) return true; } }