On Mon, 2006-10-23 at 11:13 -0500, Jim C. Nasby wrote:
> On Fri, Oct 20, 2006 at 12:05:43AM -0700, Aaron Stone wrote:
> > Ok, I think we should change the query in db_getmailbox_count to be < 2
> > because the plan really is a lot less expensive than IN (0, 1). I know
> > this was a thread/bug we had a week or two ago, but it popped into my
> > head today that maybe the planner was guessing the IN (0, 1) meant the
> > same at < 2. It doesn't, and even on Pg 8, it's still more expensive.
> > 
> > Aaron
> > 
> > dbmail=# explain select message_idnr from dbmail_messages where
> > mailbox_idnr = 1 and status in (0, 1) order by message_idnr asc;
> 
> Your results are 100% meaningless, because they do not show how long it
> actually took to run the queries. Without the data from EXPLAIN ANALYZE
> there is no basis for changing the query.

Do you have such data available?

> BTW, if you are going to change it, it would be more clear to do BETWEEN
> 0 AND 1, which the optimizer should be able to deal with just as well as
> < 2.

I am perfectly comfortable making whatever change works best. Do you
have data that shows how the BETWEEN is optimized?

Aaron

Reply via email to