时间:2021-05-23
SELECT sch.name + '.' + t.name AS [Table Name], i.name AS[Index Name], i.type_desc, ISNULL(user_updates,0) AS [Total Writes], ISNULL(user_seeks +user_scans + user_lookups,0) AS [Total Reads], s.last_user_seek, s.last_user_scan , s.last_user_lookup, ISNULL(user_updates,0) - ISNULL((user_seeks+ user_scans +user_lookups),0)AS [Difference], p.reserved_page_count * 8.0 / 1024 as SpaceInMBFROM sys.indexes AS i WITH (NOLOCK) LEFT OUTERJOIN sys.dm_db_index_usage_statsAS s WITH (NOLOCK) ON s.object_id = i.object_id AND i.index_id = s.index_id AND s.database_id=db_id() AND objectproperty(s.object_id,'IsUserTable') = 1 INNER JOIN sys.tables AS t WITH (NOLOCK) ON i.object_id = t.object_id INNER JOIN sys.schemas AS sch WITH (NOLOCK) ON t.schema_id = sch.schema_id LEFT OUTERJOIN sys.dm_db_partition_stats AS p WITH (NOLOCK) ON i.index_id = p.index_id and i.object_id = p.object_idWHERE (1=1) --AND ISNULL(user_updates,0) >=ISNULL((user_seeks + user_scans + user_lookups),0) --shows all indexesincluding those that have not been used --AND ISNULL(user_updates,0) -ISNULL((user_seeks + user_scans + user_lookups),0)>0 --only shows thoseindexes which have been used --AND i.index_id > 1 -- Only non-first indexes (I.E.non-primary key) --AND i.is_primary_key<>1 -- Only those that are not defined asa Primary Key) --AND i.is_unique_constraint<>1-- Only those that are not classed as "UniqueConstraints". ORDER BY [Table Name],[index name]
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
在Excel中如何使用SQL语句进行数据筛选?我们在使用VBA对数据库进行访问时,利用SQL语句能够方便地实现对数据库的查询。本文使用SQL语句实现多条件查询,
如何在Excel中使用SQL语言实现数据查询?SQL语句是一种标准的数据库语言,其可以在任何关系型数据库管理系统中使用。本文介绍使用SQL语句实现对Excel工
完成SQL查询并将查询结果放入Vector容器,以便其他程序使用/**执行sql查询语句*/publicstaticVectorexecuteQuery(Cla
当数据库中数据条数过多时,一个页面就不能显示,这是要设置分页查询,首先要使用的是数据库sql语句的limit条件实现分组查询sql语句大概形式为:select*
本文实例讲述了thinkPHP简单实现多个子查询语句的方法。分享给大家供大家参考,具体如下:sql语句博大精深理解好sql语句,就能用好thinkphp等框架中