mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Lower bounds related to pgstats kinds
This commit changes stats kinds to have the following bounds, making their handling in core cheaper by default: - PGSTAT_KIND_CUSTOM_MIN 128 -> 24 - PGSTAT_KIND_MAX 256 -> 32 The original numbers were rather high, and showed an impact on performance in pgstat_report_stat() for the case of simple queries with its early-exit path if there are no pending statistics to flush. This logic will be improved more in a follow-up commit to bring the performance of pgstat_report_stat() on par with v17 and older versions. Lowering the bounds is a change worth doing on its own, independently of the other improvement. These new numbers should be enough to leave some room for the following years for built-in and custom stats kinds, with stable ID numbers. At least that should be enough to start with this facility for extension developers. It can be always increased in the tree depending on the requirements wanted. Per discussion with Andres Freund and Bertrand Drouvot. Discussion: https://postgr.es/m/eb224uegsga2hgq7dfq3ps5cduhpqej7ir2hjxzzozjthrekx5@dysei6buqthe Backpatch-through: 18
This commit is contained in:
@ -18,7 +18,7 @@
|
||||
|
||||
/* Range of IDs allowed, for built-in and custom kinds */
|
||||
#define PGSTAT_KIND_MIN 1 /* Minimum ID allowed */
|
||||
#define PGSTAT_KIND_MAX 256 /* Maximum ID allowed */
|
||||
#define PGSTAT_KIND_MAX 32 /* Maximum ID allowed */
|
||||
|
||||
/* use 0 for INVALID, to catch zero-initialized data */
|
||||
#define PGSTAT_KIND_INVALID 0
|
||||
@ -46,7 +46,7 @@
|
||||
/* Custom stats kinds */
|
||||
|
||||
/* Range of IDs allowed for custom stats kinds */
|
||||
#define PGSTAT_KIND_CUSTOM_MIN 128
|
||||
#define PGSTAT_KIND_CUSTOM_MIN 24
|
||||
#define PGSTAT_KIND_CUSTOM_MAX PGSTAT_KIND_MAX
|
||||
#define PGSTAT_KIND_CUSTOM_SIZE (PGSTAT_KIND_CUSTOM_MAX - PGSTAT_KIND_CUSTOM_MIN + 1)
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
* development and have not reserved their own unique kind ID yet. See:
|
||||
* https://wiki.postgresql.org/wiki/CustomCumulativeStats
|
||||
*/
|
||||
#define PGSTAT_KIND_EXPERIMENTAL 128
|
||||
#define PGSTAT_KIND_EXPERIMENTAL 24
|
||||
|
||||
static inline bool
|
||||
pgstat_is_kind_builtin(PgStat_Kind kind)
|
||||
|
@ -59,7 +59,7 @@ static const PgStat_KindInfo injection_stats = {
|
||||
/*
|
||||
* Kind ID reserved for statistics of injection points.
|
||||
*/
|
||||
#define PGSTAT_KIND_INJECTION 129
|
||||
#define PGSTAT_KIND_INJECTION 25
|
||||
|
||||
/* Track if stats are loaded */
|
||||
static bool inj_stats_loaded = false;
|
||||
|
@ -64,7 +64,7 @@ static const PgStat_KindInfo injection_stats_fixed = {
|
||||
/*
|
||||
* Kind ID reserved for statistics of injection points.
|
||||
*/
|
||||
#define PGSTAT_KIND_INJECTION_FIXED 130
|
||||
#define PGSTAT_KIND_INJECTION_FIXED 26
|
||||
|
||||
/* Track if fixed-numbered stats are loaded */
|
||||
static bool inj_fixed_loaded = false;
|
||||
|
Reference in New Issue
Block a user