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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

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