Sql Server之旅——第八站 复合索引和include索引到底有多大区别
发布时间:2020-12-12 09:01:05 所属栏目:MsSql教程 来源:网络整理
导读:test1(ID ,Name ( ),Email ( test1 ( , , test1 ( , , idx_test1 test2(ID ,Email ( test2 ( , test2 ( , idx_test2 dbo.test2(Name) INCLUDE(Email) 2. 然后通过DBCC 命令查看数据页记录 先来看看test1表中各个槽位的信息 TRACEON( , IND(Ctrip,test1, PAGE
test1(ID ,Name (),Email ( test1 (,, test1 (,, idx_test1 test2(ID ,Email ( test2 (, test2 (, idx_test2 dbo.test2(Name) INCLUDE(Email) 2. 然后通过DBCC 命令查看数据页记录 <1> 先来看看test1表中各个槽位的信息 TRACEON(, IND(Ctrip,test1, PAGE(Ctrip,,,) Slot ,Offset ,Length Record Type INDEX_RECORD Record Attributes NULL_BITMAP Record Size Memory : 2e636f6d ?.aaaaa111 : c0000000 Slot ,Offset ,DumpStyle BYTE Record Type INDEX_RECORD Record Attributes NULL_BITMAP Record Size Memory : 2e636f6d ?.bbbbb222 : c0000000 OFFSET Row () ( () ()<2> 再来看看test2表中各个槽位信息 TRACEON(,test2,,) Slot ,DumpStyle BYTE Record Type INDEX_RECORD Record Attributes NULL_BITMAP Record Size Memory : 6161c400 ?.aaaaa........ : 2e636f6d ????????????? Slot ,DumpStyle BYTE Record Type INDEX_RECORD Record Attributes NULL_BITMAP Record Size Memory : 6262c400 ?.bbbbb........ : 2e636f6d ????????????? OFFSET Row () ( () ()<3> 从test1和test2的数据页来看,都是有两个slot槽位,然后我们把test1和test2的slot0槽位拿出来对比下,是不是就知道两者大概有什么区别了。 test1のslot0? : 2e636f6d ?.aaaaa111 |