Parameterization and filtered indexes (part 1)
4 Comments
Parameterization is a process where SQL Server slightly modifies a query in the parse phase: it replaces constant values by parameters. So if you submit — Query 1 SELECT COUNT(*) FROM Sales.SalesOrderDetail WHERE ProductID = 706; the parser will replace this by (and fool the optimizer into thinking you submitted): DECLARE @1 smallint = 706; SELECT COUNT(*) FROM Sales.SalesOrderDetail WHERE ProductID = @1; You can verify this very easily. If you go to the actual execution plan and hover over the left-most icon (the SELECT), a popup window will open that shows (a.o.) the query that was fed into the…
Read More