Re: Possible planner bug?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Possible planner bug?
Date: 2007-03-19 18:31:03
Message-ID: 15570.1174329063@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Davis <pgsql(at)j-davis(dot)com> 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;
}
}

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Howard Cole 2007-03-19 18:41:25 TSearch2 Problems
Previous Message Jeff Davis 2007-03-19 18:31:00 Re: Own messages for constraints?