pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Bret Hughes <bhughes@elevating.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: group by not returning sorted rows
Date: Mon, 5 Apr 2004 15:54:00 -0700 (PDT)
Message-ID: <20040405154818.F18308@megazone.bigpanda.com> (raw)
In-Reply-To: <1081202143.18380.117.camel@bretsony>
References: <1081202143.18380.117.camel@bretsony>

On Mon, 5 Apr 2004, Bret Hughes wrote:

> select cities.name as city, buildings.name as building,
> 	pagename,
> 	log_date ,
> 	sum(exhibition_count) as tot
> from logrecords
> 	join cities on (logrecords.city=cities.num)
> 	join buildings on (logrecords.building=buildings.num)
> where 	advertiser = 'Nielsens' and
> 	log_date >= '01/01/2004' and
> 	log_date <= '01/31/2004'
> group by cities.name, buildings.name,pagename,log_date ;
>
> I have migrated a database from a redhat 7.3 box running
> [bhughes@compaq3 reports]$ rpm -q postgresql
> postgresql-7.2.3-5.73
>
> To a redhat 9 box running :
> [bhughes@compaq2 reports]$ rpm -q postgresql
> postgresql-7.4.2-1PGDG
>
> and the rows resulting from the query are no longer sorted by log date.
> Is this a change since 7.2x?

Yes.

> I can achieve the results I need by adding an order by clause identical
> to the group by but this seems counter intuitive since the rows have to
> be ordered anyway.

They no longer need to always be pre-ordered in order to do the group by
(this depends on plan).




view thread (4+ messages)  latest in thread

Message-ID: <20040405154818.F18308@megazone.bigpanda.com>
Permalink:  ../20040405154818.F18308@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20040405154818.F18308@megazone.bigpanda.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, bhughes@elevating.com
  Subject: Re: group by not returning sorted rows
  In-Reply-To: <20040405154818.F18308@megazone.bigpanda.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