diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c index bfbfe53deb..504f952c0e 100644 --- a/src/backend/utils/activity/pgstat.c +++ b/src/backend/utils/activity/pgstat.c @@ -4,9 +4,9 @@ * * * PgStat_KindInfo describes the different types of statistics handled. Some - * kinds of statistics are collected for fixed number of objects - * (e.g. checkpointer statistics). Other kinds are statistics are collected - * for variable-numbered objects (e.g. relations). + * kinds of statistics are collected for a fixed number of objects + * (e.g., checkpointer statistics). Other kinds of statistics are collected + * for a varying number of objects (e.g., relations). * * Fixed-numbered stats are stored in plain (non-dynamic) shared memory. * @@ -19,19 +19,21 @@ * * All variable-numbered stats are addressed by PgStat_HashKey while running. * It is not possible to have statistics for an object that cannot be - * addressed that way at runtime. A wider identifier can be used when + * addressed that way at runtime. A alternate identifier can be used when * serializing to disk (used for replication slot stats). * * Each stats entry in shared memory is protected by a dedicated lwlock. * * To avoid contention on the shared hashtable, each backend has a - * backend-local hashtable (pgStatEntryRefHash) in front of the shared - * hashtable, containing references (PgStat_EntryRef) to shared hashtable - * entries. The shared hashtable only needs to be accessed when no prior - * reference to the shared hashtable exists. Besides pointing to the the - * shared hashtable entry (PgStatShared_HashEntry) PgStat_EntryRef also - * contains a pointer to the the shared statistics data, as a process-local - * address, to reduce access costs. + * read-only, backend-local, transaction-scoped, hashtable (pgStatEntryRefHash) + * in front of the shared hashtable, containing references (PgStat_EntryRef) + * to shared hashtable entries. The shared hashtable thus only needs to be + * accessed when the PgStat_HashKey is not present in the backend-local hashtable, + * or if stats_fetch_consistency = 'none'. + * + * Besides pointing to the shared hashtable entry (PgStatShared_HashEntry), + * PgStat_EntryRef also contains a pointer to the the shared statistics data, + * as a process-local address, to reduce access costs. * * The names for structs stored in shared memory are prefixed with * PgStatShared instead of PgStat. @@ -53,15 +55,16 @@ * entry in pgstat_kind_infos, see PgStat_KindInfo for details. * * - * To keep things manageable stats handling is split across several + * To keep things manageable, stats handling is split across several * files. Infrastructure pieces are in: - * - pgstat.c - this file, to tie it all together + * - pgstat.c - this file, which ties everything together * - pgstat_shmem.c - nearly everything dealing with shared memory, including * the maintenance of hashtable entries * - pgstat_xact.c - transactional integration, including the transactional - * creation / dropping of stats entries + * creation and dropping of stats entries * - * Each statistics kind is handled in a dedicated file: + * Each statistics kind is handled in a dedicated file, though their structs + * are defined here for lack of better ideas. * - pgstat_archiver.c * - pgstat_bgwriter.c * - pgstat_checkpointer.c