From 7a7f60aef8bf86b1a94908e20edd107fa9da4f3d Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 3 Jul 2023 07:09:22 +0200 Subject: Add macro for maximum statistics target The number of places where 10000 was hardcoded had grown a bit beyond the comfort level. Introduce a macro MAX_STATISTICS_TARGET instead. Reviewed-by: Tomas Vondra Discussion: https://www.postgresql.org/message-id/flat/d6069765-5971-04d3-c10d-e4f7b2e9c459%40eisentraut.org --- src/include/commands/vacuum.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/include/commands') diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index cb5b11ab31f..bda7792770a 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -305,6 +305,13 @@ extern PGDLLIMPORT int vacuum_multixact_freeze_table_age; extern PGDLLIMPORT int vacuum_failsafe_age; extern PGDLLIMPORT int vacuum_multixact_failsafe_age; +/* + * Maximum value for default_statistics_target and per-column statistics + * targets. This is fairly arbitrary, mainly to prevent users from creating + * unreasonably large statistics that the system cannot handle well. + */ +#define MAX_STATISTICS_TARGET 10000 + /* Variables for cost-based parallel vacuum */ extern PGDLLIMPORT pg_atomic_uint32 *VacuumSharedCostBalance; extern PGDLLIMPORT pg_atomic_uint32 *VacuumActiveNWorkers; -- cgit v1.2.3