SQL

Sql Tablo İndekslerinin Düzensizlikleri (fragmentation)

SQL
  -- kaç numaları veritabanındasin select DB_ID()     -- select * from sys.dm_db_index_physical_stats(5,226099846,2,0,NULL) --select * from sys.tables   --Customers tablosunun index özellikleri select I.*,* from sys.tables T INNER JOIN sys.indexes I ON I.object_id=T.object_id Where T.name='Customers'   --Customers adlı tablodaki indexlerin fragmantasyonları SELECT T.name as TABLENAME, I.name as INDEXNAME, (select avg_fragmentation_in_percent FROM sys.dm_db_index_physical_stats(DB_ID(),T.object_id,I.index_id,0,NULL)) AS FRAGMANTATION FROM sys.tables T INNER JOIN sys.indexes I ON I.object_id=T.object_id WHERE T.name='Customers'