You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support parallelism for collecting dead items during lazy vacuum.
This feature allows the vacuum to leverage multiple CPUs in order to
collect dead items (i.e. the first pass over heap table) with parallel
workers. The parallel degree for parallel heap vacuuming is determined
based on the number of blocks to vacuum unless PARALLEL option of
VACUUM command is specified, and further limited by
max_parallel_maintenance_workers.
For the parallel heap scan to collect dead items, we utilize a
parallel block table scan, controlled by ParallelBlockTableScanDesc,
in conjunction with the read stream. The workers' parallel scan
descriptions are stored in the DSM space, enabling different parallel
workers to resume the heap scan (phase 1) after a cycle of heap
vacuuming and index vacuuming (phase 2 and 3) from their previous
state. However, due to the potential presence of pinned buffers loaded
by the read stream's look-ahead mechanism, we cannot abruptly stop
phase 1 even when the space of dead_items TIDs exceeds the
limit. Therefore, once the space of dead_items TIDs exceeds the limit,
we begin processing pages without attempting to retrieve additional
blocks by look-ahead mechanism until the read stream is exhausted,
even if the the memory limit is surpassed. While this approach may
increase the memory usage, it typically doesn't pose a significant
problem, as processing a few 10s-100s buffers doesn't substantially
increase the size of dead_items TIDs.
When the parallel heap scan to collect dead items is enabled, we
disable eager scanning. This is because parallel vacuum is available
only in the VACUUM command and would not occur frequently, which
doesn't align with the purpose of eager scanning.
Reviewed-by: Amit Kapila <[email protected]>
Reviewed-by: Hayato Kuroda <[email protected]>
Reviewed-by: Peter Smith <[email protected]>
Reviewed-by: Tomas Vondra <[email protected]>
Reviewed-by: Dilip Kumar <[email protected]>
Reviewed-by: Melanie Plageman <[email protected]>
Reviewed-by: Andres Freund <[email protected]>
Discussion: https://postgr.es/m/CAD21AoAEfCNv-GgaDheDJ+s-p_Lv1H24AiJeNoPGCmZNSwL1YA@mail.gmail.com
0 commit comments