Maintenance of the system databases in SQL Server regarding the indexes is important. The system tables also have indexes and their maintenance is of asset on the busy environments.
It’s also important to know that the indexes in msdb and master are marked as system objects, so if you have your own customised scripts you should take in consideration the is_ms_shipped system column.
Going for this with Ola’s scripts, you should set the @MSShippedObjects = ‘Y’ parameter in the IndexOptimize stored procedure, like in the next example code:
EXECUTE [master].[dbo].[IndexOptimize] @Databases = 'msdb,master', @maxDop = 1, @SortInTempdb = 'Y', @FragmentationLevel1 = 5, @FragmentationLevel2 = 30, @UpdateStatistics = 'ALL', @OnlyModifiedStatistics = 'Y', @LogToTable = 'N', @MSShippedObjects = 'Y'
Cheers!