Question

Query Store is available in SQL Server 2016+ and on Azure SQL DB it is on by default. With an on-premises SQL Server, it has to be started on each database individually.

Is there a way I can have Query Store on by default when new databases are created?

Was it helpful?

Solution

Query Store is not active for new databases by default.

If you turn it on for model database, it will be on for any new databases you create in the same instance. I tested in SQL 2017.

To turn it on in model database run following:

ALTER DATABASE model SET QUERY_STORE = ON; 

I suggest you read this article and decide if you want to turn it on for all databases and settings you want to modify.

Best Practice with the Query Store

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top