SQL Server, the "Distinct clause" competition. Oops i did it again! ...from 24 seconds to 6 milliseconds!
Hi guys, Thank you all mates, the last post was very successful and therefore I propose its continuation. I recommend you read it before reading this post. We were left to the point of using the feature called grouped aggregate pushdown applied to a columnstore index. The shortest run time obtained was 56 milliseconds (I remember that we started from 30 seconds ..omg) Introduction In the last post we "played" with the "Group By". With a "Group By" clause we can use aggregate functions like COUNT, MIN,MAX,etc and perform calculation on a group of rows to return unique value: SELECT Classifiers, COUNT (Classifiers) FROM Movements GROUP BY Classifiers But if you need only to remove duplicate values and so extract distinct values we can use a DISTINCT operator we can simply write this T-SQL command: SELECT DISTINCT Classifiers FROM Movements Today we apply the same concepts we saw in the last post to a query that contains a distinct ...