Learning to Think in Sets

This is the companion page to my “Learning to Think in Sets.”

  • Slides (PDF: 479KB)
  • Demo scripts (ZIP: 21KB)
  • A SQL Server native backup used by the demo scripts, compatible with SQL Server 2012+ (ZIP: 19MB)

Here are the results from the session. The test number corresponds to the script number.

Test #TestRuntime (ms)
11Cursor13,727
12Cursor read_only fast_forward9,616
13While loop8895
14Set-based145
20Subquery (SELECT clause)3849
21Rewrite using APPLY2927
22Rewrite using #temp885
23Rewrite using RowNum521
30Scalar UDF with data access183,561
31Scalar UDF without data access109
32Multi-statement TVF194,591
33CLR184,538
34APPLY2270
35Inline TVF1755
36RowNum239
40Running total - cursor4625
41Running total - triangle join100,000,000
42Running total - windowing functions510
60C# singleton insert10041
61C# SqlBulkCopy87

Presentation History: