Hi I have a query plan that I'm trying to understand (see attachment). I'm confused as to why I see a top operator. There is no TOP in the SELECT. There is no ORDER BY. Also it seems to be selecting TOP (0) rows. I'm also confused why the estimated rows before this operator is 153,000 and after is 552,000 (the actual rows before and after is 68,000). Thanks, Matt ![alt text] INSERT INTO #LimitedData SELECT n.GeogId , a.SegId , a.TimeId , a.CatId , SUM(a.Val1 * n.Perc) AS Val1 , SUM(a.Val2 * n.Perc) AS Val2 FROM dbo.Data AS a INNER JOIN #Product AS p ON a.prodId = p.prodId INNER JOIN #Time AS t ON a.TimeId = t.TimeId INNER JOIN #Category c ON a.CatId = c.CatId INNER JOIN #Network n ON a.GeogId = n.GeogId WHERE a.criteria1 = @criteria1 AND a.criteria2 = @criteria12 GROUP BY n.GeogId , a.SegId , a.TimeId , a.CatId; [queryplan] : /storage/temp/2318-qryplan.png : /storage/temp/2324-top0query-anon.sqlplan
It has to be related to the aggregation being run. Not being able to see the plan itself and all the properties, that's about all I can tell. I'd also check to see if the optimizer timed out or completed its optimizations. And, based on the complexity of that query, I'd also check your cost threshold for parallelism. I suspect that doesn't need to be a parallel execution.