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 D59A6D1B55C for ; Fri, 14 Nov 2003 16:08:10 +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 12108-02 for ; Fri, 14 Nov 2003 12:07:39 -0400 (AST) Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) by svr1.postgresql.org (Postfix) with ESMTP id 2A50AD1B50D for ; Fri, 14 Nov 2003 12:07:36 -0400 (AST) Received: from tokyo.samurai.com (d226-89-59.home.cgocable.net [24.226.89.59]) by bob.samurai.com (Postfix) with ESMTP id 9DF361FAE; Fri, 14 Nov 2003 11:07:15 -0500 (EST) To: Josh Berkus Cc: Christopher Kings-Lynne , PostgreSQL Performance Subject: Re: Query question From: Neil Conway In-Reply-To: <200311122120.28882.josh@agliodbs.com> (Josh Berkus's message of "Wed, 12 Nov 2003 21:20:28 -0800") References: <3FB303E9.20903@familyhealth.com.au> <200311122120.28882.josh@agliodbs.com> Date: Fri, 14 Nov 2003 11:07:15 -0500 Message-ID: <87llqjj5n0.fsf@mailbox.samurai.com> User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/112 X-Sequence-Number: 4672 Josh Berkus writes: > The only thing you're adding to the query is a second SORT step, so it > shouldn't require any more time/memory than the query's first SORT > did. Interesting -- I wonder if it would be possible for the optimizer to detect this and avoid the redundant inner sort ... (/me muses to himself) -Neil