On Fri, May 7, 2021 at 2:28 PM Peter Geoghegan <p...@bowt.ie> wrote: > That's a very reasonable interpretation, since the bitmap index scans > themselves just aren't doing that much I/O -- we see that there is > much more I/O for the heap scan, which is likely to be what the > general picture looks like no matter how much bloat there is. > > However, I'm not sure if that reasonable interpretation is actually > correct. The nbtinsert.c code that handles deleting LP_DEAD index > tuples no longer relies on having a page-level garbage item flag set > in Postgres 13 -- it just scans the line pointer array for LP_DEAD > items each time.
BTW, I am pointing all of this out because I've heard informal reports of big improvements following an upgrade to Postgres 13 that seem unlikely to be related to the simple fact that indexes are smaller (most of the time you cannot save that much I/O by shrinking indexes without affected when and how TIDs/heap tuples are scanned). It's necessary to simulate the production workload to have *any* idea if LP_DEAD index tuple deletion might be a factor. If the OP is just testing this one query on Postgres 13 in isolation, without anything bloating up (or cleaning up) indexes, then that doesn't really tell us anything about how Postgres 13 compares to Postgres 12. As you said, simply shrinking the indexes is nice, but not enough -- we'd need some second of second order effect to get acceptable performance over time and under real world conditions. -- Peter Geoghegan