Heuristic to choose indexes for rebuild
The current approach is to select indexes at random for rebuilds. We can improve that, a few points we discussed are:
- Choose based on historical bloat levels (based on results of previous rebuilds). Choose indexes with historically high levels of bloat.
- Choose small indexes first, see #249662 (comment 420376511)
- Choose based on rebuild frequency (least frequently rebuilt first)
- Estimate index bloat and pick highly bloated indexes (by that estimate)
- Prioritize INVALID indexes to fix those along the way (!43834 (comment 421965514))
- ?
The goal here is to pick a strategy and implement that (one strategy, see how that works out).
Edited by Andreas Brandl