Hi to all,
DB2 seems to do a SORT before every GROUP. At least if I look at the query plan of -
-- connected to the sample db
-
SELECT WORKDEPT, SUM(SALARY)
-
FROM EMPLOYEE
-
GROUP BY WORKDEPT
-
a SORT is performed before GRPBY. I can imagine that it's necessary, but why?
Greetings, Martina.
3 2173
Hi to all,
DB2 seems to do a SORT before every GROUP. At least if I look at the query plan of -
-- connected to the sample db
-
SELECT WORKDEPT, SUM(SALARY)
-
FROM EMPLOYEE
-
GROUP BY WORKDEPT
-
a SORT is performed before GRPBY. I can imagine that it's necessary, but why?
Greetings, Martina.
Hi, how did you check that a sort is performed before the groupby?
I use Visual Explain within the Command Center.
NeoPa 32,556
Expert Mod 16PB
This is quite standard in SQL generally.
The engine has to process through the input somehow.
If it can process through by a relevant key then it will - otherwise it has to sort before it can tell if the next record is part of 'this' group or the beginning of the next.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: AJ |
last post by:
Hi ,
I have this query
paprojnumber is varchar
patx500 is text
palineitemseq is int
select Paprojnumber,Patx500,max(palineitemseq) from pa02101,pa01601
where
|
by: Betty Harvey |
last post by:
The next meeting of the XML Users Group will be held on Wednesday,
April 21, 2004 at the American Geophysical Union (AGU) at 2000
Florida Avenue, N.W., Washington, DC 20009-1277. The meeting starts...
|
by: Mike Nolan |
last post by:
I notice that 7.4 doesn't do default ordering on a 'group by', so you have
to throw in an 'order by' clause to get the output in ascending group order.
Is this something that most RDB's have...
|
by: neptune |
last post by:
I must be missing something obvious. I have 3 fields and sample data.
7890 26592 7/15/2003
7890 13645 10/6/1999
7890 58741 6/21/1992
I...
|
by: Terry E Dow |
last post by:
Howdy,
I am having trouble with the objectCategory=group member.Count attribute.
I get one of three counts, a number between 1-999, no member (does not
contain member property), or 0. Using...
|
by: Gerrit Beuze |
last post by:
Hi all,
I'm wondering if you how you organize as (in sorting / order) your C# class code:
Do you sort/ group by member type: fields, methods, properties etc.?
If yes: what ordering scheme do...
|
by: jim |
last post by:
Hi,
I was wondering if anyone out there can help me with this SQL problem:
I have a database that has two tables: EMPLOYEE and JOB_TITLE
The EMPLOYEE Table consists of a salary and job_title...
|
by: Martin.Molch |
last post by:
Hello,
DB2 seems to do a SORT before every GROUP BY action. At least if I look
at the query plan (using Visual Explain in the Command Center) of
-- connected to the sample db
SELECT WORKDEPT,...
|
by: William |
last post by:
for example, there is an array: int a={2, 3, 1,3, 2,1};
i want to group it as: {2,2,3,3,1,1} , not care the order.
i can use std::sort( &a, &a);
but this will also sort the array which will get...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |