索引相关语句

Posted wissly

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了索引相关语句相关的知识,希望对你有一定的参考价值。

查看索引使用情况

select 
    s.Name + N. + t.name as [Table]
    ,i.name as [Index] 
    ,i.is_unique as [IsUnique]
    ,ius.user_seeks as [Seeks], ius.user_scans as [Scans]
    ,ius.user_lookups as [Lookups]
    ,ius.user_seeks + ius.user_scans + ius.user_lookups as [Reads]
    ,ius.user_updates as [Updates], ius.last_user_seek as [Last Seek]
    ,ius.last_user_scan as [Last Scan], ius.last_user_lookup as [Last Lookup]
    ,ius.last_user_update as [Last Update]
from 
    sys.tables t with (nolock) join sys.indexes i with (nolock) on
        t.object_id = i.object_id
    join sys.schemas s with (nolock) on 
        t.schema_id = s.schema_id
    left outer join sys.dm_db_index_usage_stats ius on
        ius.database_id = db_id() and
        ius.object_id = i.object_id and 
        ius.index_id = i.index_id
order by
    s.name, t.name, i.index_id
option (recompile)

 

以上是关于索引相关语句的主要内容,如果未能解决你的问题,请参考以下文章

java.lang.IllegalStateException:键 f0 的片段不再存在:索引 1

javascript UV Index Monitor App订阅PubNub并显示UV索引值。博文的代码片段。在这里查看项目:https:// githu

c_cpp UV Index Indicator订阅PubNub并使用颜色显示UV索引值。博文的代码片段。在这里查看项目:https:/

PowerShell分析SQL Server待创建索引的字段与已有索引之间的相关性

SQL Select 语句的用法

[AndroidStudio]_[初级]_[配置自动完成的代码片段]