简体   繁体   English

如果我在一个表上只有一个非聚集索引,那么写入时所包含的列数是否会改变速度?

[英]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.

相关问题 要包含在非聚集索引中的列 - Columns to include in nonclustered index 我是否必须时不时地创建某个非聚集索引? - Do i have to create a certain nonclustered index every now and then? SQL:非聚集索引组多列与单列 - SQL: Nonclustered index group multiple columns vs single columns “创建非聚集索引”,那是什么,我该如何做一个? - “Create Nonclustered Index”, What is that and how do I make one? 我应该有一个表来获取下拉值还是为每个下拉创建多个表 - Should I have a single table to source the drop-down values or create multiple tables for each drop down 用于BETWEEN的日期列上的非聚集索引 - Nonclustered Index on date columns used for BETWEEN 将添加非聚集索引锁定我的表吗? - Will adding a nonclustered index lock my table? 将排序后的数据插入具有非聚集索引的表中 - Insert sorted data to a table with nonclustered index 我有一个表,该表具有由三列组成的主键。 如何索引此表? - I have a table which has a primary key that is made of three columns. How do I index this table? 在本演示中,我应该在每列上创建一个索引还是仅在一个非聚集索引上创建索引(Index Scan,Seek) - In this demo,should I create a index on each column or just one Nonclustered index (Index Scan、Seek)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM