X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 095023A1A7C for ; Fri, 7 Jan 2005 19:31:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54261-01 for ; Fri, 7 Jan 2005 19:31:30 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id E7DB43A4F10 for ; Fri, 7 Jan 2005 19:31:30 +0000 (GMT) Received: from [64.81.245.111] (account josh@agliodbs.com HELO temoku.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6878758; Fri, 07 Jan 2005 11:33:08 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: David Jaquay Subject: Re: Query across a date range Date: Fri, 7 Jan 2005 11:35:11 -0800 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <20050107182106.6CBEC5AF685@svr4.postgresql.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200501071135.11229.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.041 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/79 X-Sequence-Number: 9769 David, > The problem: Doing a query for a date range on a particular store or > market, though, for a date range of more than a few days does a > sequential scan of sales_tickets, and performs worse than doing one > single date query for each date. =A0My 'explain' for one such query is > below. Can you run EXPLAIN ANALYZE instead of just EXPLAIN? That will show you th= e=20 discrepancy between estimated and actual costs, and probably show you what= =20 needs fixing. =2D-=20 =2D-Josh Josh Berkus Aglio Database Solutions San Francisco