查索引使用情况: https://www.cnblogs.com/sunliyuan/p/6559354.html
select db_name(database_id) as N'TOPK_TO_DEV', --库名 object_name(a.object_id) as N'TopProjectNew', --表明 b.name N'索引名称', user_seeks N'用户索引查找次数', user_scans N'用户索引扫描次数', last_user_seek N'最后查找时间', last_user_scan N'最后扫描时间', rows as N'表中的行数'from sys.dm_db_index_usage_stats a join sys.indexes b on a.index_id = b.index_id and a.object_id = b.object_id join sysindexes c on c.id = b.object_idwhere database_id=db_id('TOPK_TO_DEV') ---改成要查看的数据库 and object_name(a.object_id) not like 'sys%' order by user_seeks,user_scans,object_name(a.object_id)********************************************************************************************************
sqlserver 索引优化 查碎片情况 参考网站:https://www.cnblogs.com/iiwen/p/6370420.html
use [dingyue-test2]
declare @table_id int
set @table_id=OBJECT_ID('fabu003')
dbcc showcontig(@table_id)
declare @table_id int
set @table_id=OBJECT_ID('fabu003')
dbcc showcontig(@table_id)
浙公网安备 33010602011771号