Re: The job of a relational DBMS

From: ddf <>
Date: Wed, 2 Dec 2009 06:53:43 -0800 (PST)
Message-ID: <>

On Dec 2, 2:13 am, Shakespeare <> wrote:
> Thomas Kellerer schreef:
> > Gene Wirchenko wrote on 01.12.2009 05:35:
> >>      For example, a group by in SQL forces the result to be sorted by
> >> the grouping unless otherwise overridden.
> > Never has been true. Group by does *not* sort the result. Not even in
> > Oracle 8 and and certainly not for any Oracle version > 9 (and not for
> > any Postgres as well)
> > Thomas
> Never? It did at least in Oracle 7. As a well known and too many times
> used side effect. I remember having to reprogram queries because
> developed programs relied on the sort....
> Shakespeare

Oracle never sorted the result set, it sorted the table data to effect grouping. That the result set retained the ordering enforced to provide a group by result was, and is, a side effect of the operation. In that regard Oracle still sorts (orders) the groupings, they're simply in hash key order rather than column order. Still, it's not the result set being ordered, it's the interim processing doing the ordering. And, as stated earlier, it was merely a happy coincidence that the one affected the other.

David Fitzjarrell Received on Wed Dec 02 2009 - 08:53:43 CST

Original text of this message