sccm 2012 sql task spiking high cpu

I notice that the sql process is running high on cpu.  I ran a sql query to see what sql task was causing it and I found this. Any idea what it is and how to get it under control. I tried a reboot and it didn't help.

--
-- Name         : spSummaryTaskClientOperation
-- Definition   : SqlObjs
-- Scope        : PRIMARY
-- Object       : P
-- Dependencies : <Detect>
-- Description  : Generate summary data for SMS_EndpointProtectionHealthStatus class
--
CREATE PROCEDURE spSummaryTaskClientOperation @Param nvarchar(255)=NULL, @Watermark BINARY(8)=NULL AS  
BEGIN
 
    SET NOCOUNT ON
    SET XACT_ABORT ON
 
    BEGIN TRAN
 
    -- calculate for SMS_ClientActionStatus
    MERGE INTO ClientActionSummary S
        USING (
            SELECT  s.ID,
                MAX(s.LastMessageTime) AS LastMessageTime,
                COUNT(*) AS TotalClients,
                SUM(CASE WHEN s.ActionResult NOT IN (1, 2, 3, 4) THEN 1 ELSE 0 END) AS UnknownClients,
                SUM(CASE WHEN s.ActionResult = 1 THEN 1 ELSE 0 END) AS NotApplicableClients,
                SUM(CASE WHEN s.ActionResult = 2 THEN 1 ELSE 0 END) AS FailedClients,
                SUM(CASE WHEN s.ActionResult = 3 THEN 1 ELSE 0 END) AS CompletedClients,
                SUM(CASE WHEN s.ActionResult = 4 THEN 1 ELSE 0 END) AS OfflineClients
            FROM vSMS_G_System_ClientActionStatus AS s INNER JOIN
                 v_ClientOperationTargets AS t ON s.OperationID = t.ID AND s.MachineID = t.MachineID AND s.IsVirtual = 0 INNER JOIN
                 vSMS_ClientOperation o ON o.ID = s.OperationID LEFT OUTER JOIN
                 BGB_TaskTemplate AS tt ON tt.TemplateID = o.TemplateID
            WHERE (tt.ValidSeconds IS NULL OR DATEADD(day, 1, DATEADD(second, tt.ValidSeconds, o.RequestedTime)) >= GETUTCDATE()) AND  
                  (o.State != 0 OR DATEADD(day, 1, o.ModifiedOn) >= GETUTCDATE())
            GROUP BY s.ID
        ) AS X ON S.ID=X.ID
    WHEN MATCHED THEN
        UPDATE SET LastMessageTime=X.LastMessageTime,
            TotalClients = X.TotalClients,
            UnknownClients=X.UnknownClients,
            NotApplicableClients=X.NotApplicableClients,
            FailedClients=X.FailedClients,
            CompletedClients=X.CompletedClients,
            OfflineClients = X.OfflineClients
    WHEN NOT MATCHED BY TARGET THEN
        INSERT(ID,
            LastMessageTime,
            TotalClients,
            UnknownClients,
            NotApplicableClients,
            FailedClients,
            CompletedClients,
            OfflineClients)
        VALUES(X.ID,
            X.LastMessageTime,
            X.TotalClients,
            X.UnknownClients,
            X.NotApplicableClients,
            X.FailedClients,
            X.CompletedClients,
            X.OfflineClients);
 
    -- calculate for SMS_ClientOperationStatus
    MERGE INTO ClientOperationSummary S
        USING (
            SELECT  s.ID,
                MAX(s.LastMessageTime) AS LastMessageTime,
                COUNT(*) AS TotalClients,
                SUM(IsUnknown) AS UnknownClients,
                SUM(IsNotApplicable) AS NotApplicableClients,
                SUM(IsFailed) AS FailedClients,
                SUM(IsCompleted) AS CompletedClients,
                SUM(IsOffline) AS OfflineClients
            FROM vSMS_G_System_ClientOperationStatus AS s INNER JOIN
                 v_ClientOperationTargets AS t ON s.ID = t.ID AND s.MachineID = t.MachineID INNER JOIN
                 vSMS_ClientOperation o ON o.ID = s.ID LEFT OUTER JOIN
                 BGB_TaskTemplate AS tt ON tt.TemplateID = o.TemplateID
            WHERE (tt.ValidSeconds IS NULL OR DATEADD(day, 1, DATEADD(second, tt.ValidSeconds, o.RequestedTime)) >= GETUTCDATE()) AND  
                  (o.State != 0 OR DATEADD(day, 1, o.ModifiedOn) >= GETUTCDATE())
            GROUP BY s.ID
        ) AS X ON S.ID=X.ID
    WHEN MATCHED THEN
        UPDATE SET LastMessageTime=X.LastMessageTime,
            LastSummaryTime = GETUTCDATE(),
            TotalClients = X.TotalClients,
            UnknownClients=X.UnknownClients,
            NotApplicableClients=X.NotApplicableClients,
            FailedClients=X.FailedClients,
            CompletedClients=X.CompletedClients,
            OfflineClients = X.OfflineClients
    WHEN NOT MATCHED BY TARGET THEN
        INSERT(ID,
            LastMessageTime,
            LastSummaryTime,
            TotalClients,
            UnknownClients,
            NotApplicableClients,
            FailedClients,
            CompletedClients,
            OfflineClients)
        VALUES(X.ID,
            X.LastMessageTime,
            GETUTCDATE(),
            X.TotalClients,
            X.UnknownClients,
            X.NotApplicableClients,
            X.FailedClients,
            X.CompletedClients,
            X.OfflineClients);
 
    COMMIT TRAN
 
    SELECT 1, @Watermark
 
END
rdefinoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Nagendra Pratap SinghDesktop Applications SpecialistCommented:
Since you are good with SQL please check this page.

The symptoms are very much like your. Please let us what happened after this.

https://social.technet.microsoft.com/Forums/en-US/dfb28325-8148-4c53-b54f-8cfe88969513/existing-collections-not-updating
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Server Apps

From novice to tech pro — start learning today.