Scalar UDFs vs Inline TVFs: Measuring the Damage
Scalar user-defined functions are the most natural thing in the world to write. You have a bit of logic, you wrap it in a function, you call it in your SELECT list, and your query…
What Reaches Outside Your Database? sys.dm_db_uncontained_entities
Every database likes to pretend it is self-contained. Then you restore it onto another instance and discover the stored procedure that queries a sister database, the synonym pointing at a linked server, the login-mapped user…
The Guard Clauses Your Index Rebuild Script Needs
Writing a loop that rebuilds fragmented indexes takes about ten minutes. Writing one you can safely leave running unattended at 2 AM takes considerably longer, and the difference is entirely in the guard clauses: the…
Finding Eager Index Spools in the Plan Cache
Somewhere in your plan cache right now, there is probably a query quietly building an index every single time it runs. Not once. Every execution. It builds the index, uses it, and throws it away,…
What ROW and PAGE Compression Do to the Record
Data compression is one of the few storage features you can turn on with a single clause and measure the same afternoon. It changes the physical format of the record on the page, not the…