DISTINCT vs GROUP BY Performance in SQL Query

If you ever wonder which one is really faster in Distinct vs Group By Performance Test then I will show some facts in this post so you can write your query accordingly.  

To test distinct vs group by performance in SQL Query I wrote essentially same query using two different ways. I compared execution plan generated by SQL Server. Here is my result. Looks like SQL Server was smart enough to detect that I am trying to get same result so it generated same execution plan.

So in short if you are worried about performance then take a deep breath coz SQL Server will do exactly same thing in both case.

t-sql-distinct-vs-group-by-performance

 

 

Binary World is a Software Development company located in Atlanta, USA (since 2007). Binary World specialized in Business Intelligence, mobile, cloud computing and .Net Application Development.

Tagged with: , ,
Posted in SQL Server, T-SQL Tips