X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DAE3AD1E140 for ; Thu, 19 Feb 2004 00:31:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 59429-05 for ; Wed, 18 Feb 2004 20:31:35 -0400 (AST) Received: from davinci.ethosmedia.com (server228.ethosmedia.com [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 503D4D1E0D4 for ; Wed, 18 Feb 2004 20:31:32 -0400 (AST) Received: from [63.195.55.98] (HELO 192.168.1.29) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 4453533 for pgsql-performance@postgresql.org; Wed, 18 Feb 2004 16:32:41 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "pgsql-performance" Subject: Re: Forcing filter/join order? Date: Wed, 18 Feb 2004 16:30:43 -0800 User-Agent: KMail/1.5.4 References: <200402181610.31978.josh@agliodbs.com> In-Reply-To: <200402181610.31978.josh@agliodbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200402181630.43503.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/212 X-Sequence-Number: 5736 Folks, Hmmm posted too soon. Figured out the problem: The planner can't, or doesn't want to, use an index on (event_date, (event_date + duration)) where the first column is an ascending sort and the second a descending sort. So I've coded a workaround that's quite inelegant but does get the correct results in 0.3 seconds (as opposed to the 2.2 seconds taken by the example plan). Is this the sort of thing which is ever likely to get fixed, or just a fundamental limitation of index algorithms? Would using a non B-Tree index allow me to work around this? -- -Josh Berkus Aglio Database Solutions San Francisco