Programmer's Corner Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Programmer's Corner - Forums


Difference in Queries?

 
Post new topic   Reply to topic    Programmer's Corner Forum Index -> Other Databases
Author Message
ModusPonens
if A then B, if B then C...


Joined: 22 Oct 2004
Posts: 368
Location: Baltimore

PostPosted: Fri Jul 30, 2004 12:40 pm    Post subject: Difference in Queries? Reply with quote

I am querying a table in DB2 to retrieve a list of items stored in the records. I am comparing two methods for performance and can't really tell that either is faster.

Query 1:
 SELECT DISTINCT CUSIPFROM EQUITY_POSITIONSORDER BY CUSIP


Query 2:
 SELECT CUSIPFROM EQUITY_POSITIONSGROUP BY CUSIPORDER BY CUSIP
So my question is, should one be faster?


Programmer's Corner - Tutorials, Source Code, and Help Forums for C#, C++, Java, VB, VB.NET, and Web Development.

Back to top
aschenta
*narf*


Joined: 07 May 2003
Posts: 548
Location: Windsor Ontario Canada

PostPosted: Fri Jul 30, 2004 1:53 pm    Post subject: Re: Difference in Queries? Reply with quote

well they both do basically the same thing in that instance. what it would come down to is whether you want to do an aggregate function (sum, count, average, etc) on the group by.

i tried the same type of query in mysql and it had the same result (both taking about the same time to execute).


Programmer's Corner - .NET, Web Development, SQL, C++, and more.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    Programmer's Corner Forum Index -> Other Databases All times are GMT - 5 Hours
Page 1 of 1

 


Powered by phpBB © 2001, 2002 phpBB Group