[英]If I have a single nonclustered index on a table, will the number of columns I include change the slow down when writing to it?
On the exact same table, if I was to put one index on it, either: 在完全相同的表上,如果我要在上面放一个索引,则可以:
CREATE INDEX ix_single ON MyTable (uid asc) include (columnone)
or: 要么:
CREATE INDEX ix_multi ON MyTable (uid asc) include (
columnone,
columntwo,
columnthree,
....
columnX
)
Would the second index cause an even greater lag on how long it takes to write to the table than the first one? 第二个索引会比第一个索引导致更长的写入表的延迟吗? And why?
又为什么呢?
Included columns will need more diskspace as well as time on data manipulation... 包含的列将需要更多的磁盘空间以及数据处理时间。
If there is a clustered index on this table too (ideally on a implicitly sorted column like an IDENTITY column to avoid fragmentation) this will serve as fast lookup on all columns (but you must create the clustered index before the other one...) 如果此表上也有聚簇索引(最好是在像IDENTITY列这样的隐式排序列上避免碎片化),这将作为对所有列的快速查找(但您必须在另一列之前创建聚簇索引...)
To include columns into an index is a usefull approach in extremely performance related issues only... 仅将列包含到索引中是仅在与性能非常相关的问题中有用的方法...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.