X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id A04C511F65FE for ; Thu, 13 Apr 2006 12:27:03 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: -2.326 X-Spam-Level: X-Spam-Status: No, score=-2.326 required=5 tests=[AWL=0.275, BAYES_00=-2.599, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id 4OG2XeZvEYa3 for ; Thu, 13 Apr 2006 12:26:54 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 0ADAA11F6691 for ; Thu, 13 Apr 2006 12:26:53 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k3DFQo1f020330; Thu, 13 Apr 2006 11:26:50 -0400 (EDT) To: Gavin Hamill cc: pgsql-performance@postgresql.org Subject: Re: Slow query - possible bug? In-reply-to: <443E4C9D.3090301@laterooms.com> References: <443E3DF5.4020207@laterooms.com> <3c1395330604130546g6b091f75x511955817fe65dcd@mail.gmail.com> <443E4C9D.3090301@laterooms.com> Comments: In-reply-to Gavin Hamill message dated "Thu, 13 Apr 2006 14:05:33 +0100" Date: Thu, 13 Apr 2006 11:26:50 -0400 Message-ID: <20329.1144942010@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200604/303 X-Sequence-Number: 18387 Gavin Hamill writes: > If I replace the > (allocation0_."Date" between '2006-06-09 00:00:00.000000' and > '2006-06-09 00:00:00.000000') > with > allocation0_."Date" ='2006-04-09 00:00:00.000000' > then the query comes back in a few milliseconds (as I'd expect :) Could we see EXPLAIN ANALYZE for * both forms of the date condition, with the roomid condition; * both forms of the date condition, WITHOUT the roomid condition; * just the roomid condition I'm thinking the planner is misestimating something, but it's hard to tell what without breaking it down. regards, tom lane