Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing records from a SQL query
Message
 
 
To
21/01/2010 16:22:54
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01445297
Message ID:
01445333
Views:
16
>>Can you compare the actual execution plans with and without group by to find out what takes that long?
>
>I can only do it without the group as the other one never finishes. Without the group, I do not see anything wrong except for the fact that it tries to use some combo index that someone wanted to insert in the tables recently. Would there be a way to tell SQL Server to avoid using certain indexes on such query?

I just re-read your original question again. You don't need to group by ChildPK as in your example (unless it was a complete mock) you seemed to take the first record per Parent Key, not by Parent and ChildKey combined.

If so, you need to use my suggestion.

As for your question, I think it's possible, but I need a quick research. In the worse case scenario you may want to use optimizer hints.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform