From the course: SQL Server 2022 Administration

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Setup index maintenance

Setup index maintenance

So as data in your database changes, your indexes also have to change to keep track of what's new, different, deleted. All that has to be tracked and accounted for in your index. So indexes over time have a thing called fill factor where it's how much data can fit on a page of an index. But over time what happens is a page fills up and then you get things called page splits where your index will add another page and sometimes it starts to fragment the data. So your index data gets fragmented, meaning it's not stored in a very good order. And in order to fix that, we can repair, we can rebuild indexes. And it's something you should do regularly, especially against tables where the data changes. If you have static tables that never change like lookup tables, the indexes on those will probably never really need to be rebuilt. But bigger tables, OLTP, transaction processing type tables are going to have to have their indexes rebuilt. So you want to build that into your database…

Contents