4 * Definitions related to the statistics kinds for the PostgreSQL
5 * cumulative statistics system. Can be included in backend or
8 * Copyright (c) 2001-2025, PostgreSQL Global Development Group
10 * src/include/utils/pgstat_kind.h
16/* The types of statistics entries */
17 #define PgStat_Kind uint32
19/* Range of IDs allowed, for built-in and custom kinds */
20 #define PGSTAT_KIND_MIN 1 /* Minimum ID allowed */
21 #define PGSTAT_KIND_MAX 32 /* Maximum ID allowed */
23/* use 0 for INVALID, to catch zero-initialized data */
24 #define PGSTAT_KIND_INVALID 0
26/* stats for variable-numbered objects */
27 #define PGSTAT_KIND_DATABASE 1 /* database-wide statistics */
28 #define PGSTAT_KIND_RELATION 2 /* per-table statistics */
29 #define PGSTAT_KIND_FUNCTION 3 /* per-function statistics */
30 #define PGSTAT_KIND_REPLSLOT 4 /* per-slot statistics */
31 #define PGSTAT_KIND_SUBSCRIPTION 5 /* per-subscription statistics */
32 #define PGSTAT_KIND_BACKEND 6 /* per-backend statistics */
34/* stats for fixed-numbered objects */
35 #define PGSTAT_KIND_ARCHIVER 7
36 #define PGSTAT_KIND_BGWRITER 8
37 #define PGSTAT_KIND_CHECKPOINTER 9
38 #define PGSTAT_KIND_IO 10
39 #define PGSTAT_KIND_SLRU 11
40 #define PGSTAT_KIND_WAL 12
42 #define PGSTAT_KIND_BUILTIN_MIN PGSTAT_KIND_DATABASE
43 #define PGSTAT_KIND_BUILTIN_MAX PGSTAT_KIND_WAL
44 #define PGSTAT_KIND_BUILTIN_SIZE (PGSTAT_KIND_BUILTIN_MAX + 1)
46/* Custom stats kinds */
48/* Range of IDs allowed for custom stats kinds */
49 #define PGSTAT_KIND_CUSTOM_MIN 24
50 #define PGSTAT_KIND_CUSTOM_MAX PGSTAT_KIND_MAX
51 #define PGSTAT_KIND_CUSTOM_SIZE (PGSTAT_KIND_CUSTOM_MAX - PGSTAT_KIND_CUSTOM_MIN + 1)
54 * PgStat_Kind to use for extensions that require an ID, but are still in
55 * development and have not reserved their own unique kind ID yet. See:
56 * https://wiki.postgresql.org/wiki/CustomCumulativeStats
58 #define PGSTAT_KIND_EXPERIMENTAL 24
72#endif /* PGSTAT_KIND_H */
#define PGSTAT_KIND_CUSTOM_MAX
static bool pgstat_is_kind_builtin(PgStat_Kind kind)
static bool pgstat_is_kind_custom(PgStat_Kind kind)
#define PGSTAT_KIND_CUSTOM_MIN
#define PGSTAT_KIND_BUILTIN_MAX
#define PGSTAT_KIND_BUILTIN_MIN