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 57FA3D1B18F for ; Fri, 18 Jun 2004 17:47:20 -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 95865-04 for ; Fri, 18 Jun 2004 20:47:18 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 10279D1B1EC for ; Fri, 18 Jun 2004 17:47:15 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i5IKlHdX025465; Fri, 18 Jun 2004 16:47:17 -0400 (EDT) To: =?iso-8859-1?q?Gary=20Cowell?= Cc: pgsql-performance@postgresql.org Subject: Re: Major differences between oracle and postgres performance - what can I do ? In-reply-to: <20040618154721.37105.qmail@web25105.mail.ukl.yahoo.com> References: <20040618154721.37105.qmail@web25105.mail.ukl.yahoo.com> Comments: In-reply-to =?iso-8859-1?q?Gary=20Cowell?= message dated "Fri, 18 Jun 2004 16:47:21 +0100" Date: Fri, 18 Jun 2004 16:47:17 -0400 Message-ID: <25464.1087591637@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/204 X-Sequence-Number: 7262 =?iso-8859-1?q?Gary=20Cowell?= writes: > So it seems the idea that oracle is dropping duplicate > rows prior to the sort when using distinct may indeed > be the case. Okay. We won't have any short-term solution for making DISTINCT do that, but if you are on PG 7.4 you could get the same effect from using GROUP BY: instead of select distinct version from vers where version is not null try select version from vers where version is not null group by version You should get a HashAggregate plan out of that, and I'd think it'd be pretty quick when there are not many distinct values of version. regards, tom lane