Hi Guys, The below one is my query. It's taking 12 seconds for the execution process. The count(distinct()) and SUM() functions are taking long time for execution. I tried it after create the non-cluster index but i was getting the same time. How can I avoid this issue?. select T.Name as name,T.Id as id,COUNT(distinct(DD.dynamictableid)) as counts ,ROUND(SUM(D.[employees]),0) as measure1 from dbo.TreeHierarchy T left join dbo.DynamicDataTableId DD on T.Id= DD.HierarchyId AND T.DataViewId=DD.DataViewId left join dbo.Demo1 D on D.[Demo1Id] = DD.DynamicTableId where T.DataViewId=2 AND T.ParentId=0 group by T.Id, T.Name Thanks in Advance!!!!. |
↧
SQl Server 2008 Performance Issue for Count(distinct()) and SUM() functions. How can I avoid these issues?
↧