From 18cd15e706ac1f2d6b1c49847a82774ca143352f Mon Sep 17 00:00:00 2001 From: Melanie Plageman Date: Wed, 12 Mar 2025 11:33:08 -0400 Subject: 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 Reviewed-by: Bertrand Drouvot Reviewed-by: Fujii Masao Reviewed-by: Daniel Gustafsson Reviewed-by: Jacob Champion Reviewed-by: Jelte Fennema-Nio Reviewed-by: Guillaume Lelarge Discussion: https://postgr.es/m/flat/CAAKRu_b_smAHK0ZjrnL5GRxnAVWujEXQWpLXYzGbmpcZd3nLYw%40mail.gmail.com --- doc/src/sgml/config.sgml | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 2ce93fbfa36..7ece94474d9 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -7369,6 +7369,19 @@ local0.* /var/log/postgresql + + setup_durations + + Logs the time spent establishing the connection and setting up the + backend at the time the connection is ready to execute its first + query. The log message includes the total setup duration, starting + from the postmaster accepting the incoming connection and ending + when the connection is ready for query. It also includes the time + it took to fork the new backend and the time it took to + authenticate the user. + + + all -- cgit v1.2.3