• Amit Kapila's avatar
    Allow vacuum command to process indexes in parallel. · 40d964ec
    Amit Kapila authored
    This feature allows the vacuum to leverage multiple CPUs in order to
    process indexes.  This enables us to perform index vacuuming and index
    cleanup with background workers.  This adds a PARALLEL option to VACUUM
    command where the user can specify the number of workers that can be used
    to perform the command which is limited by the number of indexes on a
    table.  Specifying zero as a number of workers will disable parallelism.
    This option can't be used with the FULL option.
    
    Each index is processed by at most one vacuum process.  Therefore parallel
    vacuum can be used when the table has at least two indexes.
    
    The parallel degree is either specified by the user or determined based on
    the number of indexes that the table has, and further limited by
    max_parallel_maintenance_workers.  The index can participate in parallel
    vacuum iff it's size is greater than min_parallel_index_scan_size.
    
    Author: Masahiko Sawada and Amit Kapila
    Reviewed-by: Dilip Kumar, Amit Kapila, Robert Haas, Tomas Vondra,
    Mahendra Singh and Sergei Kornilov
    Tested-by: Mahendra Singh and Prabhat Sahu
    Discussion:
    https://postgr.es/m/CAD21AoDTPMgzSkV4E3SFo1CH_x50bf5PqZFQf4jmqjk-C03BWg@mail.gmail.com
    https://postgr.es/m/CAA4eK1J-VoR9gzS5E75pcD-OH0mEyCdp8RihcwKrcuw7J-Q0+w@mail.gmail.com
    40d964ec
vacuum.sql 9.98 KB