Re: Embarassing GROUP question

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Embarassing GROUP question
Date: 2009-10-03 17:31:26
Message-ID: 20091003173126.GG5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Oct 03, 2009 at 01:05:49PM -0400, Tom Lane wrote:
> What you might be after is something like Postgres' DISTINCT ON
> feature

Yup, looks that way to me as well.

> I have never really played around with this aspect of MySQL ...

Me neither.

> but looking at this example, and presuming that you find that
> it actually does something useful, I wonder whether they interpret
> the combination of GROUP BY and ambiguous-per-spec ORDER BY
> in some fashion similar to DISTINCT ON.

Yup, does look that way doesn't it. It's still a weird pair of
semantics to conflate.

Hum, if they were assuming that you'd always have to implement GROUP BY
by doing a sort step first then I can see why they'd end up with this.
But if you want to do *anything* else (i.e. hash aggregate in PG) then
you want to keep the semantics of GROUP BY and ORDER BY separate as the
spec and indeed PG does.

--
Sam http://samason.me.uk/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-10-03 20:14:21 Re: Procedure for feature requests?
Previous Message Sam Mason 2009-10-03 17:24:42 Re: Procedure for feature requests?