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. 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. -- Jim C. Nasby, Database Architect [EMAIL PROTECTED] Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?"
