postgresql/src/backend
Michael Paquier 9aea73fc61 Add backend-level statistics to pgstats
This adds a new variable-numbered statistics kind in pgstats, where the
object ID key of the stats entries is based on the proc number of the
backends.  This acts as an upper-bound for the number of stats entries
that can exist at once.  The entries are created when a backend starts
after authentication succeeds, and are removed when the backend exits,
making the stats entry exist for as long as their backend is up and
running.  These are not written to the pgstats file at shutdown (note
that write_to_file is disabled, as a safety measure).

Currently, these stats include only information about the I/O generated
by a backend, using the same layer as pg_stat_io, except that it is now
possible to know how much activity is happening in each backend rather
than an overall aggregate of all the activity.  A function called
pg_stat_get_backend_io() is added to access this data depending on the
PID of a backend.  The existing structure could be expanded in the
future to add more information about other statistics related to
backends, depending on requirements or ideas.

Auxiliary processes are not included in this set of statistics.  These
are less interesting to have than normal backends as they have dedicated
entries in pg_stat_io, and stats kinds of their own.

This commit includes also pg_stat_reset_backend_stats(), function able
to reset all the stats associated to a single backend.

Bump catalog version and PGSTAT_FILE_FORMAT_ID.

Author: Bertrand Drouvot
Reviewed-by: Álvaro Herrera, Kyotaro Horiguchi, Michael Paquier, Nazir
Bilal Yavuz
Discussion: https://postgr.es/m/ZtXR+CtkEVVE/LHF@ip-10-97-1-34.eu-west-3.compute.internal
2024-12-19 13:19:22 +09:00
..
access Remove leftover mentions of XLOG_HEAP2_FREEZE_PAGE records 2024-12-18 18:47:21 -05:00
archive Apply more quoting to GUC names in messages 2024-09-04 13:50:44 +09:00
backup Clean up newlines following left parentheses 2024-11-26 17:10:07 +01:00
bootstrap Set max_safe_fds whenever we create shared memory and semaphores. 2024-12-17 12:23:26 -05:00
catalog Add backend-level statistics to pgstats 2024-12-19 13:19:22 +09:00
commands Print out error position for some more DDLs 2024-12-17 09:44:06 +09:00
executor Optimize grouping equality checks with virtual slots 2024-12-19 13:57:21 +13:00
foreign Improve style of two code paths 2024-10-08 10:51:20 +09:00
jit Require sizeof(bool) == 1. 2024-11-28 12:01:14 +13:00
lib Accommodate very large dshash tables. 2024-12-17 15:24:45 -06:00
libpq Deprecate MD5 passwords. 2024-12-02 13:30:07 -06:00
main Set the stack_base_ptr in main(), not in random other places. 2024-12-17 12:08:42 -05:00
nodes Add common interface for TBMIterators 2024-12-18 18:19:28 -05:00
optimizer Update comments about index parallel builds 2024-12-17 15:40:07 +01:00
parser Print out error position for some more DDLs 2024-12-17 09:44:06 +09:00
partitioning Remove useless casts to (void *) 2024-11-28 08:27:20 +01:00
po Translation updates 2024-06-24 13:11:27 +02:00
port Remove useless casts to (void *) 2024-11-28 08:27:20 +01:00
postmaster Set the stack_base_ptr in main(), not in random other places. 2024-12-17 12:08:42 -05:00
regex Remove pg_regex_collation 2024-12-05 07:19:37 +01:00
replication Rewrite maybe_reread_subscription() comment 2024-12-13 07:41:36 +01:00
rewrite Remove useless casts to (void *) 2024-11-28 08:27:20 +01:00
snowball Remove ts_locale.c's lowerstr() 2024-12-17 14:04:55 +01:00
statistics Use in-place updates for pg_restore_relation_stats(). 2024-12-10 16:30:37 -08:00
storage Remove EXTENSION_DONT_CHECK_SIZE from md.c. 2024-12-14 21:52:10 +13:00
tcop Set max_safe_fds whenever we create shared memory and semaphores. 2024-12-17 12:23:26 -05:00
tsearch Remove ts_locale.c's lowerstr() 2024-12-17 14:04:55 +01:00
utils Add backend-level statistics to pgstats 2024-12-19 13:19:22 +09:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile Fix make build on MinGW 2024-06-21 08:17:23 +02:00
meson.build meson: Fix import library name in Windows 2024-06-20 09:08:36 +02:00
nls.mk Add missing gettext triggers 2024-05-14 12:57:22 +02:00