diff options
author | David Rowley | 2023-04-06 23:40:31 +0000 |
---|---|---|
committer | David Rowley | 2023-04-06 23:40:31 +0000 |
commit | 1cbbee03385763b066ae3961fc61f2cd01a0d0d7 (patch) | |
tree | dbc0fc9f326d9622860592e18c49937247ef04f4 /src/include/miscadmin.h | |
parent | 5279e9db8e8da3c310c0068da2de98df5a714b2e (diff) |
Add VACUUM/ANALYZE BUFFER_USAGE_LIMIT option
Add new options to the VACUUM and ANALYZE commands called
BUFFER_USAGE_LIMIT to allow users more control over how large to make the
buffer access strategy that is used to limit the usage of buffers in
shared buffers. Larger rings can allow VACUUM to run more quickly but
have the drawback of VACUUM possibly evicting more buffers from shared
buffers that might be useful for other queries running on the database.
Here we also add a new GUC named vacuum_buffer_usage_limit which controls
how large to make the access strategy when it's not specified in the
VACUUM/ANALYZE command. This defaults to 256KB, which is the same size as
the access strategy was prior to this change. This setting also
controls how large to make the buffer access strategy for autovacuum.
Per idea by Andres Freund.
Author: Melanie Plageman
Reviewed-by: David Rowley
Reviewed-by: Andres Freund
Reviewed-by: Justin Pryzby
Reviewed-by: Bharath Rupireddy
Discussion: https://postgr.es/m/20230111182720.ejifsclfwymw2reb@awork3.anarazel.de
Diffstat (limited to 'src/include/miscadmin.h')
-rw-r--r-- | src/include/miscadmin.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 06a86f9ac1f..14bd574fc24 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -263,6 +263,15 @@ extern PGDLLIMPORT double hash_mem_multiplier; extern PGDLLIMPORT int maintenance_work_mem; extern PGDLLIMPORT int max_parallel_maintenance_workers; +/* + * Upper and lower hard limits for the buffer access strategy ring size + * specified by the VacuumBufferUsageLimit GUC and BUFFER_USAGE_LIMIT option + * to VACUUM and ANALYZE. + */ +#define MIN_BAS_VAC_RING_SIZE_KB 128 +#define MAX_BAS_VAC_RING_SIZE_KB (16 * 1024 * 1024) + +extern PGDLLIMPORT int VacuumBufferUsageLimit; extern PGDLLIMPORT int VacuumCostPageHit; extern PGDLLIMPORT int VacuumCostPageMiss; extern PGDLLIMPORT int VacuumCostPageDirty; |