diff options
author | Melanie Plageman | 2025-03-12 15:33:08 +0000 |
---|---|---|
committer | Melanie Plageman | 2025-03-12 15:35:27 +0000 |
commit | 18cd15e706ac1f2d6b1c49847a82774ca143352f (patch) | |
tree | 148f8a5def0fc9ebc2d2ccffa113395b0a4c5aea /src/include/miscadmin.h | |
parent | 9219093cab2607f34ac70612a65430a9c519157f (diff) |
Add connection establishment duration logging
Add log_connections option 'setup_durations' which logs durations of
several key parts of connection establishment and backend setup.
For an incoming connection, starting from when the postmaster gets a
socket from accept() and ending when the forked child backend is first
ready for query, there are multiple steps that could each take longer
than expected due to external factors. This logging provides visibility
into authentication and fork duration as well as the end-to-end
connection establishment and backend initialization time.
To make this portable, the timings captured in the postmaster (socket
creation time, fork initiation time) are passed through the
BackendStartupData.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Guillaume Lelarge <guillaume.lelarge@dalibo.com>
Discussion: https://postgr.es/m/flat/CAAKRu_b_smAHK0ZjrnL5GRxnAVWujEXQWpLXYzGbmpcZd3nLYw%40mail.gmail.com
Diffstat (limited to 'src/include/miscadmin.h')
-rw-r--r-- | src/include/miscadmin.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index a2b63495eec..6f16794eb63 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -394,6 +394,14 @@ extern PGDLLIMPORT BackendType MyBackendType; (AmAutoVacuumLauncherProcess() || \ AmLogicalSlotSyncWorkerProcess()) +/* + * Backend types that are spawned by the postmaster to serve a client or + * replication connection. These backend types have in common that they are + * externally initiated. + */ +#define IsExternalConnectionBackend(backend_type) \ + (backend_type == B_BACKEND || backend_type == B_WAL_SENDER) + extern const char *GetBackendTypeDesc(BackendType backendType); extern void SetDatabasePath(const char *path); |