[pgpool-hackers: 4535] New feature: log_backend_messages
Tatsuo Ishii
ishii at postgresql.org
Mon Nov 25 14:31:31 JST 2024
Currently we have various message loggings like:
- log_statement
- log_per_node_statement
- notice_per_node_statement
- log_client_messages
But we don't have logging messages from backend. The only way to know
what kind of messages come from which backend is turning on debugging
(log_min_messages). But we have too many log lines if we enable
debugging.
So my proposal is adding new parameter "log_backend_messages" which
informs what message kind comes from which backend. Sample loggings are
as follows:
2024-11-25 13:50:43.729: pgproto pid 325721: LOG: "Z" message from backend 0
2024-11-25 13:50:43.729: pgproto pid 325721: LOG: "Z" message from backend 1
2024-11-25 13:50:43.729: pgproto pid 325721: LOG: "Z" message from backend 2
2024-11-25 13:50:43.735: pgproto pid 325721: LOG: "1" message from backend 0
2024-11-25 13:50:43.735: pgproto pid 325721: LOG: "2" message from backend 0
2024-11-25 13:50:43.735: pgproto pid 325721: LOG: "D" message from backend 0
2024-11-25 13:50:43.735: pgproto pid 325721: LOG: last "D" message from backend 0 repeated 17 times
2024-11-25 13:50:43.735: pgproto pid 325721: LOG: "1" message from backend 0
2024-11-25 13:50:43.735: pgproto pid 325721: LOG: "2" message from backend 0
2024-11-25 13:50:43.735: pgproto pid 325721: LOG: "C" message from backend 0
2024-11-25 13:50:43.736: pgproto pid 325721: LOG: "1" message from backend 0
2024-11-25 13:50:43.736: pgproto pid 325721: LOG: "2" message from backend 0
2024-11-25 13:50:43.736: pgproto pid 325721: LOG: "D" message from backend 0
2024-11-25 13:50:43.736: pgproto pid 325721: LOG: last "D" message from backend 0 repeated 18 times
2024-11-25 13:50:43.737: pgproto pid 325721: LOG: "Z" message from backend 0
2024-11-25 13:50:43.737: pgproto pid 325721: LOG: "C" message from backend 0
2024-11-25 13:50:43.737: pgproto pid 325721: LOG: "Z" message from backend 0
Note the line:
2024-11-25 13:50:43.736: pgproto pid 325721: LOG: last "D" message from backend 0 repeated 18 times
This saves the log lines by indicating that some message repeated more
than once. This is useful for messages such as "D" message (DataRow)
because it is possible that backend returns lots of D messages
(imagine you retrieve 1,000 rows).
One thing maybe better to think about the feature is, whether we want to show the log line:
2024-11-25 13:50:43.735: pgproto pid 325721: LOG: DataRow message from backend 0
Instead of:
2024-11-25 13:50:43.735: pgproto pid 325721: LOG: "D" message from backend 0
The former looks nicer but we need to have a table to translate the
message kind (e.g. "D") to the message meaning ("DataRow") as
appearing in the PostgreSQL docs.
Comments and/or suggestions are welcome.
Best reagards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
More information about the pgpool-hackers
mailing list