Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] No: implied sort with group by

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas G(dot) Lockhart)
Cc: darrenk(at)insightdist(dot)com, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] No: implied sort with group by
Date: 1998-01-27 16:54:00
Message-ID: 199801271654.LAA13410@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
> 
> > > > Does the SQL standard say anything about an implied sort when
> > > > grouping or is it up to the user to include an ORDER BY clause?
> 
> Up to the user. SQL is a set-oriented language. The fact that many/most/all
> implementations order results to then do grouping is an implementation
> detail, not a language definition.
> 
> 
> > This is what I think is missing or broken right now.
> >
> > > > select * from t1;
> > >          a b  c
> > >          1    x
> > >          2    x
> > >          3    z
> > >          2    x
> > >
> > > 4 row(s) retrieved.
> > > > select b,c,sum(a) from t1 group by b,c;
> > > b  c             (sum)
> > >
> > >    x                 5
> > >    z                 3
> > >> 2 row(s) retrieved.
> 
> Sorry, I've lost the thread. What is broken? I get this same result, and
> (assuming that column "b" is full of nulls) I think this the correct result.

At one point, it was thought that NULLs shouldn't be grouped, but I
backed out the patch.  There is a problem with GROUP BY on large
datasets, and Vadim knows the cause, and will work on it later.

-- 
Bruce Momjian
maillist(at)candle(dot)pha(dot)pa(dot)us

In response to

pgsql-hackers by date

Next:From: Thomas G. LockhartDate: 1998-01-27 17:03:31
Subject: Re: [HACKERS] Re: Re: [PORTS] the 'money' type
Previous:From: Thomas G. LockhartDate: 1998-01-27 16:44:55
Subject: Re: [HACKERS] No: implied sort with group by

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group