CREATE table comp_tb
(
a tinyint
)
insert into comp_tb values('4')
insert into comp_tb values('1')
insert into comp_tb values('5')
insert into comp_tb values('6')
insert into comp_tb values('10')
insert into comp_tb values('3')
insert into comp_tb values('2')
insert into comp_tb values('8')
SELECT * from comp_tb ct --as order of insert
create NONCLUSTERED INDEX NCI_a ON comp_tb(a)
SELECT * from comp_tb ct --sorts in acending order
drop INDEX NCI_a ON comp_tb
create CLUSTERED INDEX CI_a ON comp_tb(a)
SELECT * from comp_tb ct -- sorts in acending order
drop INDEX CI_a ON comp_tb
因此聚集索引和非聚集索引都會在物理創建後立即對數據進行排序?羣集對物理和非聚集索引的數據進行排序嗎?
根據我的閱讀只有聚集索引物理排序?
+1 - 真的很酷的答案。 – Devart
@gbn的確太棒了。 –