X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 2F5DA9FB251 for ; Thu, 17 Aug 2006 16:21:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 67471-06 for ; Thu, 17 Aug 2006 16:20:57 -0300 (ADT) X-Greylist: delayed 00:11:08.241969 by SQLgrey- Received: from calvin.slamb.org (calvin.slamb.org [216.136.66.56]) by postgresql.org (Postfix) with ESMTP id B48FB9FB233 for ; Thu, 17 Aug 2006 16:20:57 -0300 (ADT) Received: by calvin.slamb.org (Postfix, from userid 103) id 82DBF6FF31; Thu, 17 Aug 2006 14:20:51 -0500 (CDT) Received: from [IPv6:::1] (localhost.slamb.org [127.0.0.1]) by calvin.slamb.org (Postfix) with ESMTP id 1F1336FE65; Thu, 17 Aug 2006 14:20:32 -0500 (CDT) In-Reply-To: <18261.1155839607@sss.pgh.pa.us> References: <44E35A5D.19933.35F376@peter.ssbg.zetnet.co.uk> <44E4430D.15373.6A0C60@peter.ssbg.zetnet.co.uk> <5321.1155820310@sss.pgh.pa.us> <18261.1155839607@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <451A4BAB-97D2-4292-9CF9-CB6DB5B3BCD4@slamb.org> Cc: "Peter Hardman" , pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Scott Lamb Subject: Re: PostgreSQL runs a query much slower than BDE and MySQL Date: Thu, 17 Aug 2006 12:20:11 -0700 To: Tom Lane X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200608/285 X-Sequence-Number: 20470 I have no idea if there's a standard name or what it may be, but for what it's worth, this sounds similar to the optimizations I wanted for a different query: http://archives.postgresql.org/pgsql-performance/2005-11/msg00037.php 1. Recognize that a term constant across the whole sort is irrelevant. (In my earlier case, a constant number, but here MAX (xxx), which seems harder.) 2. Put together two sequences already in the appropriate order, without resorting. (In my case, a union; here a join.) though I no longer need them for that problem. I'm quite happy with the client-side solution we came up with. -- Scott Lamb