help me win this "group by" argument

  • From: <babette.turnerunderwood@xxxxxxxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 23 Mar 2004 15:32:00 -0500

Two co-workers and I were discussing the mechanism that 
Oracle uses to do group by and whether sorts were required or not.

My understanding is the intermediate result set is sorted and 
whether the source data has be sorted or not depends on the
type of group by function being applied. If it is a SUM or a COUNT,
Oracle just increments the values. But if it is an average then 
Oracle sorts the original data into the group by values and then 
does the calculations.

Co-worker one says that Oracle always just increments the counts
and for a AVG it will just be incrementing the SUM and COUNT
and then use those for AVG.

Co-worker two says Oracle always sorts the data by the group by
value and then applies the function..

So who's right ?

Thanks

Other related posts: