Індекси, яких не вистачає в БД

SELECT migs.group_handle, mid.* , 'CREATE NONCLUSTERED INDEX IX_'+ Ltrim(Str(group_handle)) + ' ON ' + mid.statement +' ('+ case when equality_columns IS null then '' else equality_columns + ' ' end + case when inequality_columns IS null then '' else ', '+ inequality_columns end + ')' + case when included_columns IS null then '' else ' INCLUDE (' + included_columns +') ' end as create_index_script , avg_total_user_cost, user_seeks 

FROM sys.dm_db_missing_index_group_stats AS migs INNER JOIN sys.dm_db_missing_index_groups AS mig ON (migs.group_handle = mig.index_group_handle) 
INNER JOIN sys.dm_db_missing_index_details AS mid ON (mig.index_handle = mid.index_handle) 
ORDER BY avg_total_user_cost * avg_user_impact * (user_seeks + user_scans) DESC 

Andriy Kravchenko

Admin, Writer, File Uploader

31.10.2024 21:16:15

Зареєструйтесь, щоб відправляти коментарі
An unhandled error has occurred. Reload 🗙