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

Re: distinct vs group by

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: distinct vs group by
Date: 2005-01-29 22:23:06
Message-ID: 20050129222306.GB14571@wolff.to (view raw or flat)
Thread:
Lists: pgsql-novice
On Fri, Jan 28, 2005 at 02:35:21 -0800,
  Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com> wrote:
> 
> Should the expressions
>   select distinct x from t
> and 
>   select          x from t group by x
> have the same effect?  
> 
> It seems the optimizer sometimes chooses different plans for those
> expressions.   Could the select distinct have used the slightly
> faster hash aggregate?

I don't think select distinct can use hash aggregate plans.

In response to

pgsql-novice by date

Next:From: James DeMondDate: 2005-01-31 04:12:32
Subject: Arrays of user-defined data types in other user-defined data types
Previous:From: Tom LaneDate: 2005-01-29 22:16:48
Subject: Re: Postgres database access problem

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