[英]include column in sql server index
所有非聚集索引(NCI)還將存儲聚集索引(CI)的鍵列
在創建NCI時,如果我們有意地將鍵列包括在內,將會發生什么情況,那么占用空間又一次嗎?
表示存儲密鑰列,將占用兩次空間嗎?
提前致謝
不,空間不會占用兩次。
create table test (id int not null primary key, c1 int, c2 int)
create index ix1_test on test (c1)
create index ix2_test on test (c1) include (id)
create index ix3_test on test (c1) include (id, c2)
sp_SQLskills_SQL2012_helpindex顯示此信息:
index_name index_description index_keys included_columns columns_in_tree columns_in_leaf
[PK__test] clustered, unique, PK [id] NULL [id] All columns "included"
[ix1_test] nonclustered [c1] NULL [c1], [id] [c1], [id]
[ix2_test] nonclustered [c1] [id] [c1], [id] [c1], [id]
[ix3_test] nonclustered [c1] [id], [c2] [c1], [id] [c1], [id], [c2]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.