If I execute the following:
SELECT dbschemas.[name] as 'Schema',
dbtables.[name] as 'Table',
dbindexes.[name] as 'Index',
indexstats.alloc_unit_type_desc,
indexstats.avg_fragmentation_in_percent as avg,
indexstats.page_count
FROM sys.dm_db_index_physical_stats (DB_ID('dbname'), NULL, NULL, NULL, NULL) AS indexstats
INNER JOIN sys.tables dbtables on dbtables.[object_id] = indexstats.[object_id]
INNER JOIN sys.schemas dbschemas on dbtables.[schema_id] = dbschemas.[schema_id]
INNER JOIN sys.indexes AS dbindexes ON dbindexes.[object_id] = indexstats.[object_id]
AND indexstats.index_id = dbindexes.index_id
WHERE indexstats.database_id = DB_ID('dbname')
ORDER BY indexstats.avg_fragmentation_in_percent desc
It shows fragmentation level. I then ran Ola Hallengren's index optimise script which obviously reduces indexes.
If I run the query again it now shows high fragmentation in tables without an index e.g:
Schema Table Index alloc_unit_type_desc avg page_cont
dbo tablename NULL IN_ROW_DATA 99.4362934362934 8176
Should I be concerned by these?
Anything I can do?
Anything I should be doing?
We are experiencing performance issues. I am aware that 2008 is not ideal and that is being addressed.
The datafile is also showing as 220gb but the actual space used is 140gb.