Skip site navigation (1) Skip section navigation (2)

Re: DISTINCT -> GROUP BY

From: Decibel! <decibel(at)decibel(dot)org>
To: David Fetter <david(at)fetter(dot)org>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DISTINCT -> GROUP BY
Date: 2008-06-04 12:36:41
Message-ID: 8404931B-038E-4F98-98C9-BCEC81B476DF@decibel.org (view raw or flat)
Thread:
Lists: pgsql-hackers
On Jun 3, 2008, at 9:03 AM, David Fetter wrote:
> On Tue, Jun 03, 2008 at 03:36:44PM +0200, Pavel Stehule wrote:
>> Hello David
>>
>> http://www.postgresql.org/docs/faqs.TODO.html
>>
>> Consider using hash buckets to do DISTINCT, rather than sorting This
>> would be beneficial when there are few distinct values. This is
>> already used by GROUP BY.
>
> It's nice to see that this is kinda on the TODO, but it doesn't
> address the question I asked, which is, "how would I get the planner
> to rewrite DISTINCTs as the equivalent GROUP BYs?" :)

IIRC, the patch to allow GROUP BY to do hashing is fairly recent...  
you could probably find it in archives.
-- 
Decibel!, aka Jim C. Nasby, Database Architect  decibel(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828


In response to

pgsql-hackers by date

Next:From: Decibel!Date: 2008-06-04 12:44:53
Subject: Re: Proposal: new function array_init
Previous:From: Decibel!Date: 2008-06-04 12:35:04
Subject: Re: intercepting WAL writes

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group