X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E3B589DC993 for ; Tue, 17 Jan 2006 18:40:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52681-03 for ; Tue, 17 Jan 2006 18:40:38 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by postgresql.org (Postfix) with ESMTP id D756A9DC99E for ; Tue, 17 Jan 2006 18:40:34 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id E2639356DB; Tue, 17 Jan 2006 14:40:36 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id DB3063569C; Tue, 17 Jan 2006 14:40:36 -0800 (PST) Date: Tue, 17 Jan 2006 14:40:36 -0800 (PST) From: Stephan Szabo To: Josh Berkus Cc: pgsql-performance@postgresql.org, J@planeti.biz Subject: Re: Multiple Order By Criteria In-Reply-To: <200601171425.38772.josh@agliodbs.com> Message-ID: <20060117143952.D47156@megazone.bigpanda.com> References: <05c301c61bb1$d88c6a00$681e140a@fatchubby> <200601171425.38772.josh@agliodbs.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.084 required=5 tests=[AWL=0.084] X-Spam-Score: 0.084 X-Spam-Level: X-Archive-Number: 200601/271 X-Sequence-Number: 16749 On Tue, 17 Jan 2006, Josh Berkus wrote: > J, > > > I have an index built for each of these columns in my order by clause. > > This query takes an unacceptable amount of time to execute. Here are the > > results of the explain: > > You need a single index which has all five columns, in order. I think he'll also need a reverse opclass for the first column in the index or for the others since he's doing desc, asc, asc, asc, asc.