Slow query spikes CPU

Khy2shy 2015-11-20 20:26:01

This query make lots of read and increases CPU when accessed on concurrently. Can you help tune it?

SELECT ah.[RSSAppHistoryKey]
FROM [dbo].[RSSAppHistory] ah
SELECT RSSFunctionalGroup, RSSPartyKey, MaxKey = MAX(RSSAppHistoryKey)
FROM [dbo].[RSSAppHistory]
WHERE ISNULL(ActiveFlag, ") = "
GROUP BY RSSFunctionalGroup, RSSPartyKey
) mk
ON ah.RSSAppHistoryKey = mk.MaxKey

Aaron Bertrand 2015-11-23 16:14:31
Need a lot more information – can you show an actual query plan generated from within Plan Explorer? Can you tell us about any indexes on RSSAppHistory? Can you explain why so many of these columns (and every single row in the table) are needed for output? Why is ActiveFlag a nullable string instead of a non-nullable bit column? What version of SQL Server are you using?