SQL Server statistics – read only database

Oopps! Upgrade your browser pretty please. Oopps! Upgrade your browser pretty please.

The default setting for auto create statistics is on in SQL server, and this setting enables the SQL engine to create column statistics as needed by the optimizer, BUT statistics are not created if the database is read only. Of course, that makes sense, but you might get terrible performance if you don’t have the statistics.

If you intend to set the database to read only, make sure you create the statistics you need before you set the datase in read only, otherwise, the sql optimizer may choose a bad plan based on “guestimates”.