Multiple OPTIMIZE FOR hints in one query are written as one list: each parameter gets its own value or UNKNOWN. This post compiles the same query six ways, reads the compile values and estimated rows from the plan cache, and shows which combinations SQL Server accepts.
SQL SERVER – DISTINCT Does Not Guarantee ORDER BY
DISTINCT removes duplicate result rows without guaranteeing their order. My original claim that it always sorts output was incorrect.
SQL SERVER – TOP and DISTINCT – Epic Confusion – SQL in Sixty Seconds #141
DBAs from the client’s organization ended up an argument about how T-SQL works. The discussion was about the epic confusion about TOP and DISTINCT.
DDL in a Transaction: What Rolls Back and What Blocks
DDL in a transaction works in SQL Server: CREATE, ALTER and DROP roll back like any other change. This post proves it with a small demo, lists the statements that are refused inside a transaction, and shows which locks an open DDL transaction holds and who has to wait for them.
Uniquifier: The Hidden Cost of Duplicate Clustered Keys
The uniquifier is a hidden 4-byte value that SQL Server adds to duplicate keys in a non-unique clustered index. This post measures its real cost row by row on SQL Server 2025 and shows it on the page. It also compares it with a unique key you choose yourself.
How to Write Efficient Query? – Interview Question of the Week #300
Question: How to Write Efficient Query?
Answer: There is no right or wrong answer to this question. Let us learn about it today.
Rewriting Correlated Subqueries as Window Functions
Replace correlated subqueries with windowed counts, dates, and running totals, preserve detail rows, and keep useful EXISTS filters.







