pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Claudio Freire <klaussfreire@gmail.com>
To: Robert Klemme <shortcutter@googlemail.com>
Cc: Uwe Bartels <uwe.bartels@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: big distinct clause vs. group by
Date: Tue, 19 Apr 2011 11:22:05 +0200
Message-ID: <BANLkTikOUovTjsK8_9htTjrocHJxrGUv2g@mail.gmail.com> (raw)
In-Reply-To: <BANLkTindpLiBP7faprcJvUVC=2zE7ZDJBg@mail.gmail.com>
References: <AANLkTi=SwWco0mJcU549tzMXJ0kmBwCsNHabH8OUjg1M@mail.gmail.com>
	<BANLkTimuvQr3Lvyh6T6fbKDs1v34Bi5=aQ@mail.gmail.com>
	<BANLkTimPgtYKLyEE8K0NKoE=DAvgm7p8+A@mail.gmail.com>
	<BANLkTimC-ta9cEy2218YJhWXKJAzhXSOuw@mail.gmail.com>
	<BANLkTi=KcJh3FFgzTtM=3onJFZaY+=xNLw@mail.gmail.com>
	<BANLkTindpLiBP7faprcJvUVC=2zE7ZDJBg@mail.gmail.com>

On Tue, Apr 19, 2011 at 11:07 AM, Robert Klemme
<shortcutter@googlemail.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.



view thread (11+ messages)  latest in thread

Message-ID: <BANLkTikOUovTjsK8_9htTjrocHJxrGUv2g@mail.gmail.com>
Permalink:  ../BANLkTikOUovTjsK8_9htTjrocHJxrGUv2g@mail.gmail.com/
Also on:    postgresql.org/message-id/BANLkTikOUovTjsK8_9htTjrocHJxrGUv2g@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: klaussfreire@gmail.com, shortcutter@googlemail.com, uwe.bartels@gmail.com
  Subject: Re: big distinct clause vs. group by
  In-Reply-To: <BANLkTikOUovTjsK8_9htTjrocHJxrGUv2g@mail.gmail.com>
  References: <AANLkTi=SwWco0mJcU549tzMXJ0kmBwCsNHabH8OUjg1M@mail.gmail.com> <BANLkTimuvQr3Lvyh6T6fbKDs1v34Bi5=aQ@mail.gmail.com> <BANLkTimPgtYKLyEE8K0NKoE=DAvgm7p8+A@mail.gmail.com> <BANLkTimC-ta9cEy2218YJhWXKJAzhXSOuw@mail.gmail.com> <BANLkTi=KcJh3FFgzTtM=3onJFZaY+=xNLw@mail.gmail.com> <BANLkTindpLiBP7faprcJvUVC=2zE7ZDJBg@mail.gmail.com> <BANLkTikOUovTjsK8_9htTjrocHJxrGUv2g@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox