Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: group by default order

Re: group by default order

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Wed, 22 Jun 2005 07:31:44 -0400
Message-ID: <v7idnb6bs7O-0STfRVn-tw@comcast.com>

"Serge Rielau" <srielau_at_ca.ibm.com> wrote in message news:3hsvecFihm5jU2_at_individual.net...
> hkongogo_at_gmail.com wrote:
>> given a table
>>
>> create table product
>> (
>> product_id integer primary key,
>> category varchar2(100),
>> sale_count integer
>> )
>>
>> what would be the order of
>>
>> select category, sum(sale_count) from product group by category;
>>
>> seems the order in 8i and 9i are different
>>
> There are many ways for a DBMS to do grouping, only some of which will
> result in a complete order.
> Imagine the table being range partitioned on sale_count.
> The DBMS can run local group by-s without ever getting a total order.
> Other options involve hashing..
>
> Cheers
> Serge
> --
> Serge Rielau
> DB2 SQL Compiler Development
> IBM Toronto Lab

the retrieval order without an explicit ORDER BY would also be affected by the physical order of the rows, which will very likely differ in the two databases

++ mcs Received on Wed Jun 22 2005 - 06:31:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US