Advertisement
Intermediate SQL Server, Query Store

What is the difference between Query Store's READ_WRITE and READ_ONLY operational modes, and when does SQL Server switch between them?

Short answer

In READ_WRITE mode, Query Store actively captures new query and plan information as queries run, while in READ_ONLY mode it stops capturing new data but still allows you to view previously captured history, which SQL Server automatically switches to if Query Store reaches its…

Save SQL Server mock interview
Advertisement
AModel answer
In READ_WRITE mode, Query Store actively captures new query and plan information as queries run, while in READ_ONLY mode it stops capturing new data but still allows you to view previously captured history, which SQL Server automatically switches to if Query Store reaches its configured maximum storage size, requiring you to either increase the size limit or clean up old data to resume active capturing.
-- Check the current operational mode
SELECT actual_state_desc FROM sys.database_query_store_options;
Real-world example
A database administrator notices Query Store has silently stopped capturing new data and discovers it switched to READ_ONLY mode after reaching its storage limit, prompting them to increase the allocated size and clean up old, unnecessary data.
Likely follow-ups
  • How do you manually switch Query Store back to READ_WRITE mode?
  • What causes Query Store to silently stop capturing data without an obvious error?
Related topics