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 ABBB032A08B for ; Thu, 7 Oct 2004 21:26:16 +0100 (BST) 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 01157-04 for ; Thu, 7 Oct 2004 20:26:08 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id BA927329E8B for ; Thu, 7 Oct 2004 21:26:07 +0100 (BST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i97KQ4Jm002823 for ; Thu, 7 Oct 2004 20:26:04 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i97K02mH094943 for pgsql-performance@postgresql.org; Thu, 7 Oct 2004 20:00:02 GMT From: Mischa Sandberg Reply-To: ischamay.andbergsay@activestateway.com User-Agent: Mozilla Thunderbird 0.7.3 (X11/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 X-Newsgroups: comp.databases.postgresql.performance Subject: Re: sequential scan on select distinct References: <200410061130.58625.ole@freiheit.com> <29194.1097091506@sss.pgh.pa.us> <200410071921.08685.ole@freiheit.com> <199.1097170001@sss.pgh.pa.us> In-Reply-To: <199.1097170001@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 22 Message-ID: <8fh9d.25089$MV5.20638@clgrps13> Date: Thu, 07 Oct 2004 20:00:04 GMT To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=NO_DNS_FOR_FROM X-Spam-Level: * X-Archive-Number: 200410/132 X-Sequence-Number: 8608 Tom Lane wrote: > Ole Langbehn writes: > >>>What do you think about the idea of an "UniqueSort" which would do >>>sort+unique in one pass ? > >>This is what oracle does and it is quite fast with it... > Hashing is at least as fast, if not faster. > > regards, tom lane I got good mileage in a different SQL engine, by combining the hash-aggregate and sort nodes into a single operator. The hash table was just an index into the equivalent of the heap used for generating runs. That gave me partially aggregated data, or eliminated duplicate keys, without extra memory overhead of the hash-aggregation node below the sort. Memory was scarce then ... :-) BTW I'm really puzzled that Oracle is pushing 'index skip scan' as a new feature. Wasn't this in the original Oracle Rdb --- one of Gennady Antoshenkov's tweaks?