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 199A7D1B74E for ; Fri, 18 Jun 2004 14:01:56 -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 80950-05 for ; Fri, 18 Jun 2004 17:01:53 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2689ED1B54D for ; Fri, 18 Jun 2004 14:01:51 -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 i5IH1pS3022515; Fri, 18 Jun 2004 13:01:51 -0400 (EDT) To: Stephen Frost Cc: Gary Cowell , pgsql-performance@postgresql.org Subject: Re: Major differences between oracle and postgres performance - what can I do ? In-reply-to: <20040618163003.GM11196@ns.snowman.net> References: <20040618132554.72968.qmail@web25103.mail.ukl.yahoo.com> <20412.1087570627@sss.pgh.pa.us> <20040618163003.GM11196@ns.snowman.net> Comments: In-reply-to Stephen Frost message dated "Fri, 18 Jun 2004 12:30:03 -0400" Date: Fri, 18 Jun 2004 13:01:51 -0400 Message-ID: <22514.1087578111@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/198 X-Sequence-Number: 7256 Stephen Frost writes: > * Tom Lane (tgl@sss.pgh.pa.us) wrote: >> [... thinks for awhile ...] It seems possible that they may use sort >> code that knows it is performing a DISTINCT operation and discards >> duplicates on sight. Given that there are only 534 distinct values, >> the sort would easily stay in memory if that were happening. > Could this optimization be added to PostgreSQL? It sounds like a very > reasonable thing to do. That's what I was wondering about too. But first I'd like to get some kind of reading on how effective it would be. If someone can demonstrate that Oracle can do sort-and-drop-dups a lot faster than it can do a straight sort of the same amount of input data, that would be a strong indication that it's worth doing. At this point we don't know if that's the source of their win or not. regards, tom lane