mirror of
https://github.com/postgres/postgres.git
synced 2025-11-22 12:22:45 +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:
@@ -120,7 +120,7 @@ static void tidstore_iter_extract_tids(TidStoreIter *iter, BlockNumber blkno,
|
||||
* by TidStoreMemoryUsage().
|
||||
*/
|
||||
TidStore *
|
||||
TidStoreCreateLocal(size_t max_bytes)
|
||||
TidStoreCreateLocal(size_t max_bytes, bool insert_only)
|
||||
{
|
||||
TidStore *ts;
|
||||
size_t initBlockSize = ALLOCSET_DEFAULT_INITSIZE;
|
||||
@@ -138,11 +138,22 @@ TidStoreCreateLocal(size_t max_bytes)
|
||||
maxBlockSize = ALLOCSET_DEFAULT_INITSIZE;
|
||||
|
||||
/* Create a memory context for the TID storage */
|
||||
ts->rt_context = AllocSetContextCreate(CurrentMemoryContext,
|
||||
if (insert_only)
|
||||
{
|
||||
ts->rt_context = BumpContextCreate(CurrentMemoryContext,
|
||||
"TID storage",
|
||||
minContextSize,
|
||||
initBlockSize,
|
||||
maxBlockSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
ts->rt_context = AllocSetContextCreate(CurrentMemoryContext,
|
||||
"TID storage",
|
||||
minContextSize,
|
||||
initBlockSize,
|
||||
maxBlockSize);
|
||||
}
|
||||
|
||||
ts->tree.local = local_ts_create(ts->rt_context);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user