Re: big distinct clause vs. group by

From: Claudio Freire <klaussfreire(at)gmail(dot)com>
To: Robert Klemme <shortcutter(at)googlemail(dot)com>
Cc: Uwe Bartels <uwe(dot)bartels(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: big distinct clause vs. group by
Date: 2011-04-19 09:22:05
Message-ID: BANLkTikOUovTjsK8_9htTjrocHJxrGUv2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Apr 19, 2011 at 11:07 AM, Robert Klemme
<shortcutter(at)googlemail(dot)com> wrote:
> I find that slightly contradictory: either you do care about the
> values then your business requirements dictate the aggregate function.
>  If you only want to pick any value actually in the table but do not
> care about which one (e.g. MIN or MAX or any other) then you don't
> actually care about the value.  Because "SELECT a, MAX(b) ... GROUP BY
> a" and "SELECT a, MIN(b) ... GROUP BY a" are not equivalent.  And, if
> you do not care then there is probably no point in selecting them at
> all.  At best you could use a constant for any legal value then.

I know it sounds weird, but there are at times when you only want one
of the actual values - but don't care which one precisely.

It happened to me at least once.

So, it may sound as nonsense, but it is probably not. Just uncommon.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Laurent Laborde 2011-04-19 09:28:45 Re: postgresql random io test with 2 SSD Kingston V+100 500GB in (software) Raid1
Previous Message Laurent Laborde 2011-04-19 09:15:30 postgresql random io test with 2 SSD Kingston V+100 500GB in (software) Raid1