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 57B29528AA for ; Mon, 13 Jun 2005 13:54:34 -0300 (ADT) 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 74711-01 for ; Mon, 13 Jun 2005 16:54:28 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 62F17528BF for ; Mon, 13 Jun 2005 13:54:28 -0300 (ADT) Received: (qmail 13699 invoked by uid 500); 13 Jun 2005 16:53:55 -0000 Date: Mon, 13 Jun 2005 11:53:55 -0500 From: Bruno Wolff III To: Kevin Grittner Cc: tgl@sss.pgh.pa.us, linux@alteeve.com, john@arbash-meinel.com, tobias@nordicbet.com, pgsql-performance@postgresql.org Subject: Re: Index ot being used Message-ID: <20050613165355.GB12557@wolff.to> Mail-Followup-To: Bruno Wolff III , Kevin Grittner , tgl@sss.pgh.pa.us, linux@alteeve.com, john@arbash-meinel.com, tobias@nordicbet.com, pgsql-performance@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/304 X-Sequence-Number: 12941 On Mon, Jun 13, 2005 at 11:46:46 -0500, Kevin Grittner wrote: > I agree that ignoring useless columns in an ORDER BY clause is less > important than ignoring index columns where the value is fixed. There > is one use case for ignoring useless ORDER BY columns that leaps to > mind, however -- a column is added to the ORDER BY clause of a query to > help out the optimizer, then the indexes are modified such that that > column is no longer useful. Whether this merits the programming effort > and performance hit you describe seems highly questionable, though. I suspect that this isn't a big deal. There was a question like that that has been going back and forth over the last couple of days. If you remove the constant expression from the index, you aren't likely going to use the index anyway, but will instead sort the output rows from either a sequential scan or an index scan based on an index that does use the constant expression.