question

mbvnaveen5 avatar image
mbvnaveen5 asked

My Select query with more group by columns is running very slow

I am writing a Select query to load one Fact table. This requires 75 columns in SELECT along with SUM() which leads to use all columns in GROUP by as well. This is messing up my query, group by with 75 columns not performing fine. Can any one suggest on tuning this query

selectcolumns
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Oleg avatar image Oleg commented ·

@mbvnaveen5 There are ways to avoid the problem with too many columns in the group by clause. In fact, it might be possible to get rid of such clause altogether by restating the query with using APPLY. While you don't have to post the entire query, post a short version of it (with just few columns included), or else provide some details, including the version of SQL Server in question. Otherwise, it is difficult to offer a meaningful help. Thank you.

0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.