使用索引优化 SQL Server 查询
我一直在阅读一些有关查询优化的文章。所有文章都提到索引
作为另一种查询优化技术。但在有关索引的部分的末尾,会有一条声明不鼓励在操作数据库上使用索引。将会有类似下面的语句:
每次对数据库进行写入时,索引在更新之前都无法使用。如果数据库不断接收写入,那么索引将永远不可用。这就是为什么索引通常应用于数据仓库中的数据库,这些数据库会按计划(非高峰时段)更新新数据,而不是应用于可能一直接收新写入的生产数据库。
我的问题是,如何计算对操作数据库有用的可接受的索引写入速率?
我还没有找到可以指导我如何做出这一决定的资源。
I have been reading some articles on query optimization. All articles mention indexing
as another technique for query optimization. But at the end of a section on indexing, there will be a statement discouraging the use of indexes on an operational database. There will be a statement similar to the one below:
Every time a write is made to the database, the indexes are unusable until they have updated. If the database is constantly receiving writes then the indexes will never be usable. This is why indexes are typically applied to databases in data warehouses that get new data updated on a scheduled basis(off-peak hours) and not production databases which might be receiving new writes all the time.
My question is, how do I calculate the acceptable rate of write for indexes to be useful on an operational database?
I have not found a resource that can guide me on how to make this determination.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试“重新组织”索引而不是“重建”索引。重组索引不会锁定表。 <一href="https://learn.microsoft.com/en-us/sql/relational-databases/indexes/reorganize-and-rebuild-indexes?view=sql-server-ve r15#:%7E:text=To%20reorganize%20all%20indexes%20in%20a%20table%201,Indexes%20to%20be%20reorganized%20...%20More%20items%20" rel="nofollow noreferrer">根据微软的说法:
Try "reorganize" index instead of "rebuild" index. Reorganizing an index does not lock the tables. According to Microsoft: