Why Won't PostgreSQL Use My Covering Index?
Dear Postgres, Why won’t you use my covering index?
Lately I’ve been learning to tune queries running against PostgreSQL, and it’s …
Read Moreon • 2 min read
For static databases, it’s quite useful to set SQL Server’s “read only” database property to true. When the database is read-only, it ensures that the last backup you took is still valid… as long as nothing bad happens to that backup file.
But can SQL Server 2016’s Query Store feature work with a read only database?
I tested this out on the new WideWorldImporters sample database from Microsoft. I made sure Query Store was working in the database, then set the database to read-only.
Upon refreshing my Query Store report…

If we take a look into sys.database_query_store_options, we get some insight into what’s going on here:

Our desired state is READ_WRITE, but our actual state is READ_ONLY. Reason: 1.
Digging into the documentation, the possible reasons our query store might go READ_ONLY include:
At least for now, Query Store can only record query performance in databases that are read-write. Once you go read-only you can review the performance of past queries, but you can’t track the performance of anyone who queried the database after the point it went read-only.
At least for now. Query Store is such an awesome feature that perhaps this will change in the future. (I don’t have any inside info, only optimism.)
While the database must be read-write, Query Store uses only the Primary filegroup. You can potentially move your tables to a read-only filegroup and make it the default, but you’ll have to write custom code to keep anyone from using the Primary filegroup, or any other read-write filegroup. Read more on the SQLDoubleG blog.
Copyright (c) 2025, Catalyze SQL, LLC; all rights reserved. Opinions expressed on this site are solely those of Kendra Little of Catalyze SQL, LLC. Content policy: Short excerpts of blog posts (3 sentences) may be republished, but longer excerpts and artwork cannot be shared without explicit permission.