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 9E1D89F9998 for ; Thu, 17 Aug 2006 10:11:57 -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 20532-10 for ; Thu, 17 Aug 2006 10:11:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D7BA19FA2E9 for ; Thu, 17 Aug 2006 10:11:52 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k7HDBobB005322; Thu, 17 Aug 2006 09:11:50 -0400 (EDT) To: "Peter Hardman" cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL runs a query much slower than BDE and MySQL In-reply-to: <44E4430D.15373.6A0C60@peter.ssbg.zetnet.co.uk> References: <44E35A5D.19933.35F376@peter.ssbg.zetnet.co.uk> <44E4430D.15373.6A0C60@peter.ssbg.zetnet.co.uk> Comments: In-reply-to "Peter Hardman" message dated "Thu, 17 Aug 2006 10:21:01 +0100" Date: Thu, 17 Aug 2006 09:11:50 -0400 Message-ID: <5321.1155820310@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.181 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/281 X-Sequence-Number: 20466 "Peter Hardman" writes: > I wonder whether Paradox and MySQL are just not doing the sort (this > seems to be what eats up the time), since the output of the subquery > is in fact already in the proper order. MSSQL (from the other thread). I feel fairly safe in assuming that MySQL's query optimizer is not nearly in the league to do this query effectively. (I like the theory Arjen mentioned that what you are measuring there is the effects of their query cache rather than a smart fundamental implementation.) I wonder whether MSSQL has an EXPLAIN equivalent ... Anywy, your point about the sort being redundant is a good one, and offhand I'd have expected PG to catch that; I'll have to look into why it didn't. But that's not going to explain a 10x speed difference, because the sort isn't 90% of the runtime. regards, tom lane