Hi All: I have a CTE query against a table with 32K rows that runs fine in 2008R2. I am running it in 2014 Std Ed. against the same data and it runs very slowly. Looking at the execution plan I think I see what's contributing to the slowness.[img]http://216.218.227.138/tablespool.png[/img]Note that the "actual number of rows" is some 351M...how is this possible? the query:declare @amts table (claim int,allowed decimal(12,2),copay decimal(12,2),deductible decimal(12,2),coins decimal(12,2));;with unpaid (claimID) as (select claimID from claim where amt+copay + disct+mm + ded=0)insert @amts select lineID, sum(rc), sum(copay), sum(deduct), case when sum(mm)>0 and (sum(mm)<sum(mmamt)) then sum(mm) else 0 endfrom claimlnwhere status is nulland lineID not in (select claimID from unpaid)group by lineIDit's like there's some massively recursive process going on?
↧