What do you understand by index_id = 0 and Index_id = 1? What they represent?
What do you understand by index_id = 0 and Index_id = 1?
If we have a query like
If we have a query like
select top 100 index_id, * from sys.indexes where index_id = 0
Ans: If you have created an clustred index for a table then value of that table stored in sys.indexes as index_id 1, and if you have not create index then value store as 0
So, Heap tables (ones with no clustered index) will always have one index with entry index_id = 0, and tables with clustered indexes will always have an entry with index_id = 1
Comments