Ola Hallengren’s IndexOptimize for Updating Statistics exclude schema

ola-hallengren

I am using Ola Hallengren's IndexOptimize for Updating Statistics only. Can I exclude a schema from the UpdateStatistics?

Best Answer

Ola covers this scenario in the documentation.

For the @Indexes parameter:

The ALL_INDEXES keyword is supported. The hyphen character (-) is used to exclude indexes, and the percent character (%) is used for wildcard selection. All these operations can be combined by using the comma (,).

If you want to do "everything on the server, except one schema in one database" you'd supply parameters like @Databases='ALL_DATABASES', @Indexes= 'ALL_INDEXES, -Db1.Schema1.%'.

If you want to do "everything on the server, except never the staging schema in any database" you'd supply parameters like @Databases='ALL_DATABASES', @Indexes= 'ALL_INDEXES, -%.staging.%'.