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

What is dirty read?

622


how to trace the traffic hitting a sql server? : Sql server database administration

1116


Explain sql server authentication modes?

597


Explain some stored procedure creating best practices or guidelines?

510


What are the purposes of floor and sign functions?

526






What are the differences between union, intersect, and minus operators?

562


What it means to be triggered?

492


Can We Use Data-grids For Our Report In Ssrs?

147


Explain how to use linked server?

551


How to resolve the orphan use problem? : sql server security

515


What is the advantage of sql server?

531


What does COMMIT command do?

618


What is the New in SQL server 2008?

567


What is the difference between varchar and varchar(max) datatypes?

543


What is the difference between varchar and nvarchar?

516