查询数据库索引使用情况
来源:互联网 发布:守望先锋cg 知乎 编辑:程序博客网 时间:2024/05/20 13:05
SELECT @@SERVERNAME AS [ServerName] , DB_NAME() AS [DatabaseName] , SCHEMA_NAME([sObj].[schema_id]) AS [SchemaName] , [sObj].[name] AS [ObjectName] , CASE WHEN [sObj].[type] = 'U' THEN 'Table' WHEN [sObj].[type] = 'V' THEN 'View' END AS [ObjectType] , [sIdx].[index_id] AS [IndexID] , ISNULL([sIdx].[name], 'N/A') AS [IndexName] , CASE WHEN [sIdx].[type] = 0 THEN 'Heap' WHEN [sIdx].[type] = 1 THEN 'Clustered' WHEN [sIdx].[type] = 2 THEN 'Nonclustered' WHEN [sIdx].[type] = 3 THEN 'XML' WHEN [sIdx].[type] = 4 THEN 'Spatial' WHEN [sIdx].[type] = 5 THEN 'Reserved for future use' WHEN [sIdx].[type] = 6 THEN 'Nonclustered columnstore index' END AS [IndexType] , [sdmvIUS].[user_seeks] AS [TotalUserSeeks] , [sdmvIUS].[user_scans] AS [TotalUserScans] , [sdmvIUS].[user_lookups] AS [TotalUserLookups] , [sdmvIUS].[user_updates] AS [TotalUserUpdates] , [sdmvIUS].[last_user_seek] AS [LastUserSeek] , [sdmvIUS].[last_user_scan] AS [LastUserScan] , [sdmvIUS].[last_user_lookup] AS [LastUserLookup] , [sdmvIUS].[last_user_update] AS [LastUserUpdate] , [sdmfIOPS].[leaf_insert_count] AS [LeafLevelInsertCount] , [sdmfIOPS].[leaf_update_count] AS [LeafLevelUpdateCount] , [sdmfIOPS].[leaf_delete_count] AS [LeafLevelDeleteCount]FROM [sys].[indexes] AS [sIdx] INNER JOIN [sys].[objects] AS [sObj] ON [sIdx].[object_id] = [sObj].[object_id] LEFT JOIN [sys].[dm_db_index_usage_stats] AS [sdmvIUS] ON [sIdx].[object_id] = [sdmvIUS].[object_id] AND [sIdx].[index_id] = [sdmvIUS].[index_id] AND [sdmvIUS].[database_id] = DB_ID() LEFT JOIN [sys].[dm_db_index_operational_stats](DB_ID(), NULL, NULL, NULL) AS [sdmfIOPS] ON [sIdx].[object_id] = [sdmfIOPS].[object_id] AND [sIdx].[index_id] = [sdmfIOPS].[index_id]WHERE [sObj].[type] IN ( 'U', 'V' ) -- Look in Tables & Views AND [sObj].[is_ms_shipped] = 0x0 -- Exclude System Generated Objects AND [sIdx].[is_disabled] = 0x0
0 0
- 查询数据库索引使用情况
- 数据库索引使用情况
- mysql查询索引使用情况
- oracle数据库查询Sql语句是否使用索引及常见的索引失效的情况
- 查询sqlserver 索引的使用情况
- PG数据库查看索引使用情况
- 查询数据库的空间使用情况
- 查询数据库对象block使用情况
- oracle数据库表空间使用情况查询
- ORACLE数据库存储空间使用情况查询
- MySQL中查询不使用索引的情况汇总
- 数据库性能优化(强制使用索引查询)
- 使用索引优化数据库查询效率
- 使用索引优化数据库查询效率
- 检测索引使用情况
- 查看索引使用情况
- PostgreSQL中主键索引为什么不能被查询利用到?---索引使用情况一例
- 数据库忽略索引的情况
- UIViewContentMode
- soapUI测试webservice(参数为xml格式的处理方式)
- log4j日志文件路径问题
- 游戏作弊器制作教程三:内存与Cheat Engine
- JS调用android
- 查询数据库索引使用情况
- Http协议
- 十三种基于直方图的图像全局二值化算法原理、实现、代码及效果。
- Cannot find protocol definition for 'TencentSessionDelegate'
- admob里集成KeyMob横幅广告教程
- react native常用modules
- Life Movie
- [leetcode] 111. Minimum Depth of Binary Tree
- liferay学习之二:实例