简体   繁体   English

SQL Server索引INSERT / UPDATE性能

[英]SQL Server Indexes INSERT/UPDATE Performance

I know that indexes hurt insert/update performance, but I'm trying to troubleshoot and determine the right balance between query performance and insert/update performance. 我知道索引会影响插入/更新性能,但是我正在尝试解决问题并确定查询性能和插入/更新性能之间的正确平衡。

We've created a number of views (about 20) for some really really complicated queries. 我们为一些非常复杂的查询创建了许多视图(约20个)。 They're really slow for seeking by keys (can take 20 seconds to scan for 5 to 10 keys). 它们按键查找的速度确实很慢(扫描5至10个键可能需要20秒)。

Indexing these views (with both clustered and non-clustered indexes on the various key columns) speeds up their performance in the area of 80x to 100x. 索引这些视图(在各个键列上使用聚集索引和非聚集索引)可将其性能提高80倍至100倍。 It also hurts insert/update performance to the point that a script which inserts about 100 rows into various related tables takes about 45 seconds to run instead of being instantaneous. 这还会损害插入/更新性能,以至于脚本将大约100行插入到各种相关表中,而不是立即执行,大约需要45秒才能运行。

I'd prefer not to go the OLAP route for these views (it would add a whole new layer of complexity....and the views are currently updatable, which would pose a reverse synchronization problem)...so I'm trying to figure out how to balance query performance with insert/update performance. 我不希望为这些视图使用OLAP路由(这将增加一层新的复杂性。...并且这些视图当前是可更新的,这将带来反向同步问题)...所以我正在尝试找出如何在查询性能与插入/更新性能之间取得平衡。

Can someone please suggest how to diagnose the specific problem indexes - and potential ways of reducing their impact on inserts/updates? 有人可以建议如何诊断特定的问题索引,以及减少对插入/更新的影响的潜在方法吗?

I've already tried using covering indexes, indexes with INCLUDEs and composite clustered indexes as alternatives to see if it makes a difference (it doesn't really). 我已经尝试过使用覆盖索引,包含INCLUDE的索引和复合聚簇索引作为替代方案,以查看它是否有所作为(实际上并没有)。

Thanks. 谢谢。

在这种情况下,请使用单列其他过滤索引,并避免包含两列以上的复合索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM