Tag Info

New answers tagged

1

Index Scan scans each and every record in the index. Table Scan is where the table is processed row by row from beginning to end. If the index is a clustered index then an index scan is really a table scan. Since a scan touches every row in the table whether or not it qualifies, the cost is proportional to the total number of rows in the table. Index Seek: ...


4

How does the query processor execute COMPUTE BY? It is a hard-coded sequence of operations at the top of the execution tree. There is a simple stream accumulation (hence the ordering requirement), some logic to detect the start of a new group, a little computation and data value copying, and direct calls to construct the alternate TDS result sets per ...


0

I can reproduce this and the short 'quick fix' answer is: add the HASH JOIN hint to the query, eg select divn_nbr, dept_nbr, vendorNumber, pid, nrfcolorNumber, periodcode from ##tmpSFA a where periodCode = '201512' and not exists ( select 1 from ##tmpSFA b where ISNULL(a.divn_nbr, -99) = isnull(b.divn_nbr, -99) and isnull(a.dept_nbr, ...


3

NOT EXISTS can introduce a TOP 1 (as can EXCEPT in some cases). This is because it only cares about the fact that at least one row exists. This is called short circuiting, and you want this - it is much more likely to speed up your query than slow it down. And I'd be really surprised if the TOP didn't show up in the plan for different date ranges, unless ...



Top 50 recent answers are included