On Sat, Apr 24, 2021 at 1:17 PM Peter Geoghegan <p...@bowt.ie> wrote: > On Sat, Apr 24, 2021 at 12:56 PM Andres Freund <and...@anarazel.de> wrote: > > Imo the question isn't really whether criteria will ever do something > > wrong, but how often and how consequential such mistakes will > > be. E.g. unnecessarily vacuuming an index isn't fun, but it's better > > than ending up not never cleaning up dead index pointers despite repeat > > accesses (think bitmap scans). > > I strongly agree. The risk with what I propose is that we'd somehow > overlook a relevant extreme cost. But I think that that's an > acceptable risk.
IMV the goal here is not really to skip index vacuuming when it's unnecessary. The goal is to do *more* index vacuuming when and where it *is* necessary (in one problematic index among several) -- maybe even much much more. We currently treat index vacuuming as an all-or-nothing thing at the level of the table, which makes this impossible. This is another reason why we can be pretty conservative about skipping. We only need to skip index vacuuming those indexes that we're pretty confident just don't need it -- that's sufficient to be able to do vastly more index vacuuming where it is needed in almost all cases. There is some gray area, but that seems much less interesting to me. -- Peter Geoghegan