PSPO plan variants let SQL Server cache up to three plans for one parameterized query when the data is very skewed. This post builds a skewed table, shows two variants with different reads for three calls, compares the same calls with the feature off, and explains when PSPO does not apply.
Prepared Statements and Plan Reuse From Application Code
Inspect prepared statements, handle lifetimes, parameter types, cached Prepared plans, and the limits of optimize for ad hoc workloads.
Live Plans for Running Queries With sys.dm_exec_query_statistics_xml
Read sys.dm_exec_query_statistics_xml for live plans, compare profile counts with estimates, and interpret partial progress carefully.
Remove Key Lookup – SQL in Sixty Seconds #194
Today, we are going to see one more trick from the book – Remove Key Lookup and improve the performance of queries.
Splitting OR Conditions Into UNION ALL for Index Seeks
Test splitting OR conditions into disjoint UNION ALL branches, preserve NULL behavior and row identity, and compare actual index access.
Cached Plan Reuse: How to Tell if a Query Used a Cached Plan
Cached plan reuse is invisible in a result set. This post shows three checks on SQL Server: the compiled and runtime parameter values in the plan, the usecounts column of the plan cache, and the plan creation time.
TOP N Sort: Why a Small TOP Still Reads the Whole Table
Explain TOP N Sort, compare an indexed ordered access path, and align filter and sort keys before adding indexes for frequent requests.







