查看一个表的Index info
1,Script1
--query index in a table select o.name,o.object_id, i.name as indexname,i.index_id,i.type_desc, ic.column_id,ic.is_included_column,ic.key_ordinal as Index_column_Ordinal, c.name as columnname from sys.objects o inner join sys.indexes i on o.object_id=i.object_id inner join sys.index_columns ic on i.object_id=ic.object_id and i.index_id=ic.index_id inner join sys.columns c on o.object_id=c.object_id and ic.column_id=c.column_id where o.name=‘FactProduct‘ order by i.index_id
2,Script2
--query index in a table include filter index select o.name,o.object_id, i.name as indexname,i.index_id,i.type_desc, ic.column_id,ic.is_included_column,ic.key_ordinal as Index_column_Ordinal, c.name as columnname, i.has_filter,i.filter_definition from sys.objects o inner join sys.indexes i on o.object_id=i.object_id inner join sys.index_columns ic on i.object_id=ic.object_id and i.index_id=ic.index_id inner join sys.columns c on o.object_id=c.object_id and ic.column_id=c.column_id where o.name=‘factProduct‘ order by i.index_id
时间: 2024-11-05 12:24:21