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 # | Test | Runtime (ms) |
|---|---|---|
| 11 | Cursor | 13,727 |
| 12 | Cursor read_only fast_forward | 9,616 |
| 13 | While loop | 8895 |
| 14 | Set-based | 145 |
| 20 | Subquery (SELECT clause) | 3849 |
| 21 | Rewrite using APPLY | 2927 |
| 22 | Rewrite using #temp | 885 |
| 23 | Rewrite using RowNum | 521 |
| 30 | Scalar UDF with data access | 183,561 |
| 31 | Scalar UDF without data access | 109 |
| 32 | Multi-statement TVF | 194,591 |
| 33 | CLR | 184,538 |
| 34 | APPLY | 2270 |
| 35 | Inline TVF | 1755 |
| 36 | RowNum | 239 |
| 40 | Running total - cursor | 4625 |
| 41 | Running total - triangle join | 100,000,000 |
| 42 | Running total - windowing functions | 510 |
| 60 | C# singleton insert | 10041 |
| 61 | C# SqlBulkCopy | 87 |
Presentation History: