Does index_id=0 in sys.indexes refer to the table itself?

三世轮回 提交于 2019-12-06 09:28:54

Does index_id=0 in sys.indexes refer to the table itself?

No, For heap based tables it will always exist and it refers to the IAM (Index Allocation Map). For tables with clustered indexes it will not exist.

Notice the "type_desc" is HEAP on these indexes, there is a really good blog entry about the Index Allocation Map.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!