22-25 April 2026

What Happens If I Write This?

Proposed session for SQLBits 2026

TL; DR

A Live T-SQL Experiment Session where we look at patterns and test them live. The good, the bad and the ugly.

Session Details

We all write T-SQL that seems reasonable, but do we really know how SQL Server will execute it?

In this live, experiment-driven session, we’ll take common (and not-so-common) T-SQL patterns and put them to the test in SQL Server. Using real queries, real data, and real execution plans, we’ll explore what actually happens when you write different joins, predicates, window functions, and subqueries. Along the way, we’ll intentionally break best practices, challenge assumptions, and uncover surprising optimizer behavior.

Attendees will be encouraged to predict outcomes before we run each query, turning the session into an interactive learning experience. You’ll leave with a stronger intuition for how SQL Server processes T-SQL, why some “obvious” choices perform poorly, and how small changes in query structure can lead to dramatically different execution plans.

This session is less about rules and more about understanding, so the next time you write T-SQL, you’ll know what happens before you hit execute.

3 things you'll get out of this session

Predict how SQL Server will execute common T-SQL patterns by recognizing how small changes in query structure affect execution plans and performance. Identify risky or misleading T-SQL constructs that appear correct but often lead to inefficient plans, excessive resource usage, or unexpected results. Apply practical query rewrites with confidence to influence the optimizer toward more efficient execution without relying on guesswork or folklore.