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
What happens when transaction log is full?
What are the different types of indexes?
How to see existing views in ms sql server?
Can you pass expressions to stored procedure parameters?
how would you troubleshoot blocking? : Sql server database administration
What is the concept of optimization?
What are drilldown reports?
why does a sql statement work correctly outside of a user-defined function, but incorrectly inside it? : Sql server administration
Define primary key?
What is ddl and dml commands?
What is the sql server 2000 version number?
Is there any performance difference between if exists (select null from table) and if exists (select 1 from table)?
Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting are possible?
What are differences in between sql server 2012 and sql server 2016?
How is SQL Azure different than SQL server?