1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Use bump context for TID bitmaps stored by vacuum

Vacuum does not pfree individual entries, and only frees the entire
storage space when finished with it. This allows using a bump context,
eliminating the chunk header in each leaf allocation. Most leaf
allocations will be 16 to 32 bytes, so that's a significant savings.
TidStoreCreateLocal gets a boolean parameter to indicate that the
created store is insert-only.

This requires a separate tree context for iteration, since we free
the iteration state after iteration completes.

Discussion: https://postgr.es/m/CANWCAZac%3DpBePg3rhX8nXkUuaLoiAJJLtmnCfZsPEAS4EtJ%3Dkg%40mail.gmail.com
Discussion: https://postgr.es/m/CANWCAZZQFfxvzO8yZHFWtQV+Z2gAMv1ku16Vu7KWmb5kZQyd1w@mail.gmail.com
This commit is contained in:
John Naylor
2024-04-07 12:27:34 +07:00
parent bb766cde63
commit 8a1b31e6e5
5 changed files with 28 additions and 7 deletions

View File

@ -2874,7 +2874,7 @@ dead_items_alloc(LVRelState *vacrel, int nworkers)
dead_items_info->num_items = 0;
vacrel->dead_items_info = dead_items_info;
vacrel->dead_items = TidStoreCreateLocal(dead_items_info->max_bytes);
vacrel->dead_items = TidStoreCreateLocal(dead_items_info->max_bytes, true);
}
/*
@ -2910,7 +2910,7 @@ dead_items_reset(LVRelState *vacrel)
/* Recreate the tidstore with the same max_bytes limitation */
TidStoreDestroy(dead_items);
vacrel->dead_items = TidStoreCreateLocal(vacrel->dead_items_info->max_bytes);
vacrel->dead_items = TidStoreCreateLocal(vacrel->dead_items_info->max_bytes, true);
/* Reset the counter */
vacrel->dead_items_info->num_items = 0;