To turn Query Store on or off for every database, you need one statement per database, because there is no server switch. This post builds a tested script that writes the statements, lets you read them and then runs them in one batch. It also covers READ_ONLY mode and the model database.
Query Store Status for Every Database in SQL Server
Query Store status for every database takes two queries, and the first is not enough. This post builds four demo databases, shows why the is_query_store_on flag hides frozen and read-only states, and runs one script that reads the real state of each database. It also shows what Query Store costs in memory.
SQL SERVER – Blocking Tree – Identifying Blocking Chain Using SQL Scripts
Whenever I end up on a situation where we have lots of blocking issues with my client, I depend on the script of the Blocking Tree.
Query for CPU Pressure: Sample the Scheduler Queue
To sample the scheduler queue, read the runnable counts of every scheduler eight times, one second apart, and compare the result with a baseline. This post shows the queue on a quiet server and again while more busy sessions than schedulers run. It reads the spread, the streak and the average that tell pressure from noise.
Canceled Query Plan: Three Ways to Capture It in SQL Server
A canceled query plan can be captured with Live Query Statistics, with a live plan query while the statement runs, or from Query Store after the cancel. This post runs a long query, reads its plan while it runs, cancels it and then reads the aborted run from Query Store. It also explains which plan each method returns.
Batch Requests and Compilations per Second From T-SQL
Calculate compilations per second from cumulative SQL Server counters, compare batch rates, and investigate single-use plans with context.
What is the Difference Between sql_handle and plan_handle?- Interview Question of the Week #269
Question: What is the Difference Between sql_handle and plan_handle?
Answer: I was recently asked this question. Let us see the answer today.







