pgsql: Refresh cost-based delay params more frequently in autovacuum

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема pgsql: Refresh cost-based delay params more frequently in autovacuum
Дата
Msg-id E1pkYdW-001kmr-3f@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Refresh cost-based delay params more frequently in autovacuum

Allow autovacuum to reload the config file more often so that cost-based
delay parameters can take effect while VACUUMing a relation. Previously,
autovacuum workers only reloaded the config file once per relation
vacuumed, so config changes could not take effect until beginning to
vacuum the next table.

Now, check if a reload is pending roughly once per block, when checking
if we need to delay.

In order for autovacuum workers to safely update their own cost delay
and cost limit parameters without impacting performance, we had to
rethink when and how these values were accessed.

Previously, an autovacuum worker's wi_cost_limit was set only at the
beginning of vacuuming a table, after reloading the config file.
Therefore, at the time that autovac_balance_cost() was called, workers
vacuuming tables with no cost-related storage parameters could still
have different values for their wi_cost_limit_base and wi_cost_delay.

Now that the cost parameters can be updated while vacuuming a table,
workers will (within some margin of error) have no reason to have
different values for cost limit and cost delay (in the absence of
cost-related storage parameters). This removes the rationale for keeping
cost limit and cost delay in shared memory. Balancing the cost limit
requires only the number of active autovacuum workers vacuuming a table
with no cost-based storage parameters.

Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion:
https://www.postgresql.org/message-id/flat/CAAKRu_ZngzqnEODc7LmS1NH04Kt6Y9huSjz5pp7%2BDXhrjDA0gw%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7d71d3dd080b9b147402db3365fe498f74704231

Modified Files
--------------
src/backend/access/heap/vacuumlazy.c  |   2 +-
src/backend/commands/vacuum.c         |  46 +++++-
src/backend/commands/vacuumparallel.c |   1 -
src/backend/postmaster/autovacuum.c   | 291 ++++++++++++++++++++--------------
src/include/commands/vacuum.h         |   1 +
5 files changed, 219 insertions(+), 122 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Stabilize just-added regression test cases.
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: heapam: Pass number of required pages to RelationGetBufferForTup