In performance wise distinct is good or group by is good?
eg:select name from emp group by name;
select distinct name from emp;

Answer Posted / ghorban adabi

I have test DISTINCT and GROUP BY query on a table in my
site db with 7800 record. the results that turned GROUP BY
was faster than DISTINCT!!!
GROUP BY result -> Query took 0.0094 sec
DISTINCT result -> Query took 0.0133 sec

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to insert data with null values?

596


What are system databases in ms sql server?

541


What is primary key index?

543


What do mean by xml datatype?

625


Can a cursor be updated? If yes, how you can protect which columns are updated?

527






Recommend an approach to ensuring that all changes in the remote databases synchronize with the SQL Azure database?

106


How you can get the list of largest tables in a database?

535


How to delete a login name in ms sql server?

548


Explain in details security in SQL azure?

97


How can we call UDF(User Define Function) using C# code in ASP.net ?

5950


What are cursors and when they are useful?

581


What do you understand by a view? What does the with check option clause for a view do?

613


What are character string data types in ms sql server?

644


What is normalization? Explain its different types?

609


What is the significance of master, tempdb and model databases?

533