Index Maintenance

后端 未结 2 1937
陌清茗
陌清茗 2021-01-01 04:00

What is Index Maintenance and how do I do it? How frequently do I have to do it? What are the benefits? This is related to a transaction table which is subject to frequentl

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-01 04:58

    In general, a DBMS will look after the index automatically so that it still works. However, with enough insert, delete and update operations, it is conceivable that there will be room for improvement in the index. That is, if the index were dropped and recreated, the resulting index would be smaller and more efficient than the modified index. And, ultimately, smaller indexes mean fewer I/O operations, and I/O operations are vastly more expensive than calculations.

    There may be answers specific to SQL Server that I'm not aware of, but:

    • Index maintenance would be a process that makes an index perform better.
    • One way to do index maintenance is to drop and rebuild an index.
    • Another way might be to alter the table in such a way that the indexes have to be rebuilt (cluster it, perhaps).
    • You probably don't need to do it very often, but it will depend primarily on the quality of MS SQL Server and the way it handles indexes. I'd expect that to be at least adequate. Maybe once a month, if you have convenient down-time available to do it. Otherwise, less frequently to not at all.
    • The benefit is less space used by the index and better performance using the index.

提交回复
热议问题