Question: How to Know If Index is Forced on Query?
Answer: Let me tell you a brief story so you understand the context of the question.
Question: How to Know If Index is Forced on Query?
Answer: Let me tell you a brief story so you understand the context of the question.
Read NonParallelPlanReason in actual and cached plans, then check MAXDOP, scalar functions, table variables, and query cost.
A long-running query for demonstrations has to run long enough to watch and stop when you say. This post builds one from a counting table, shows how its run time grows with the row count and explains how to watch and stop it. It also compares it with WAITFOR DELAY.
A cheap answer to the multiple table delete puzzle reads only 6 pages and passes the check. It can still delete the wrong row. This post shows the answer, asks you to find the row it removes by mistake, and fixes it with a delete that costs 5 reads.
Use filtered statistics to describe skewed customer values, inspect histograms, and test estimates under literal and parameterized queries.
The fewest logical reads for the multiple table delete puzzle come from reading each table as few times as the rules allow. A string of student IDs gets to 4 reads. A set based delete needs 5 and is the one to use. The starting script needed 19.
Unique index performance gains come from what the optimizer learns, not from smaller pages. A tested demo compares pages, reads, plans and CPU for a plain index and a unique index. It also shows the error a duplicate causes.