I've inherited of a couple of databases which indexes have never been maintained (rebuilt, reorganized).
I'm using Ola Hallengren's Index maintenance script, I've used the following script to record the difference between the pre-maintenance and post-maintenance values.
SELECT OBJECT_NAME(IPS.object_id) AS [TableName] , SI.name AS [IndexName] , IPS.Index_type_desc , IPS.avg_fragmentation_in_percent , IPS.avg_fragment_size_in_pages , IPS.avg_page_space_used_in_percent , IPS.record_count , IPS.ghost_record_count , IPS.fragment_count -- ,IPS.avg_fragment_size_in_pages FROM sys.dm_db_index_physical_stats(DB_ID(N'test_db'), NULL, NULL, NULL, 'DETAILED') IPS JOIN sys.tables ST WITH (NOLOCK) ON IPS.object_id = ST.object_id JOIN sys.indexes SI WITH (NOLOCK) ON IPS.object_id = SI.object_id AND IPS.index_id = SI.index_id WHERE ST.is_ms_shipped = 0 ORDER BY 3 Desc, 4 Desc
However, I didn't notice any changes on the various indexes having an
avg_fragmentation_in_percent above 30%.
Are index maintenance tasks supported on SQL Server 2008R2 Web Editions?