Amour22015
asked on
SQL Server 2012 r2 - Sum causes too much time
Hi Experts,
I have this small query:
When I introduce the line:
,Sum(rd.[Total Vulnerabilities]) as [Total Vulnerabilities]
This query will come from .37 to > 2 mins. on timing.
What can I do to the Sum line to make this more faster?
Thank You for helping...
I have this small query:
SELECT
rd.[ScanDate]
,Rd.Plugin as [Plugin]
--,Sum(rd.[Total Vulnerabilities]) as [Total Vulnerabilities]
FROM dflt.SCCM_v_R_System as srs
inner join dflt.Systems AS rs on rs.IPLong = srs.IPLong
inner join [Dflt].[ReportsData_ALLPluginsTotalsOS] as rd On rs.Plugin = rd.Plugin
WHERE rs.ScandateID in (Select top 6 ID From Dflt.ScanDates Order by ID desc)
Group By rd.ScanDate, rd.Plugin
When I introduce the line:
,Sum(rd.[Total Vulnerabilities]) as [Total Vulnerabilities]
This query will come from .37 to > 2 mins. on timing.
What can I do to the Sum line to make this more faster?
Thank You for helping...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you can post the query execution plan when you're using the SUM it would be helpful to understand what's causing the issue.
ASKER
Thank you all for helping as for a Execution plan. I know that the tables a large and the Vulnerablity total would take time. Just looking for a way to improve query performance.