21.10.09

Sys.Index table in sql server

All about Sys. Indexes table:

Sys.Indexes table will list down all the indexes available in the database. In detail, it will list down the clustered indexes, Non-clustered indexes and heap.

Clustered indexes will restructure the entire data inside the table where as non clustered index will create a pointed inside the table.

On executing the below query,

select * from sys.indexes

The table will hold the name of the index/type of the index/fill factor/ its working nature /hold primary key/unique key etc..,

To find the disabled indexes:

select * from sys.indexes where is_disabled = 1

To find, whether the index holds primary key (Index created due to the primary key on the table)
select * from sys.indexes where is_primary_key=1

To find, whether the index holds unique key on the column:
select * from sys.indexes where is_unique_constraint=1

Thanks and Regards,

Venkatesan Prabu .J

1 comment:

  1. In case of SQL Server 2000, Below is the approach

    By using the sysindexes table, you can find the clustered and non-clustered index with the help of indid column.
    if indid is :
    1 = Clustered index
    >1 = Nonclustered

    ReplyDelete