

Our users are locked into selecting data and joining back to the employee data with In our employee hierarchy, we (or our predecessors) have EffectiveEndDT always 1 day before the next EffectiveStartDT for that employee.

What's the price of that product on the transition date? The one on EffectiveStartDT of the later timeline. This helps to enforce no overlapping dates for a product.

Interesting article Dwain requires that, for a given product, the EffectiveStartDT of the next timeline matches the EffectiveEndDT of the previous. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.ĬPU time = 4352 ms, elapsed time = 2156 ms.ĬPU time = 4352 ms, elapsed time = 1878 ms. Scan count 5, logical reads 4713, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. PARTITION BY ProductID ORDER BY CONVERT(BINARY(8),EffectiveStartDT,0) WHERE d IS NOT NULL AND d EffectiveStartDT PARTITION BY ProductID ORDER BY DATEDIFF(DAY,0,EffectiveStartDT) SELECT ProductID, EffectiveStartDT, EffectiveEndDT, ProductPrice Did similar recently which brought the execution time down by 40% The second thing has to do with the sorting implied by the LEAD, simplifying the work by date diffing to 0 does improve the performance there, narrowing the "worktable" i guess makes a difference.
#Recursive bookmark sorter does not sort by date code
Some thoughts, first of all the 1M test code only produced 100 rows until I adjusted the top clauses. Good article as always Dwain, thank you very much.
