diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 075b243183..bd396f0f08 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -817,13 +817,6 @@ GetCurrentTransactionStopTimestamp(void) void SetCurrentStatementStartTimestamp(void) { - /* - * Skip if on a walsender; this is not needed, and it confuses monitoring - * if we publish non-NULL values. - */ - if (am_walsender) - return; - if (!IsParallelWorker()) stmtStartTimestamp = GetCurrentTimestamp(); else diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index 05240bfd14..93b7814418 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -726,7 +726,13 @@ pg_stat_get_activity(PG_FUNCTION_ARGS) else nulls[7] = true; - if (beentry->st_xact_start_timestamp != 0) + /* + * Don't expose transaction time for walsenders; it confuses + * monitoring, particularly because we don't keep the time up-to- + * date. + */ + if (beentry->st_xact_start_timestamp != 0 && + beentry->st_backendType != B_WAL_SENDER) values[8] = TimestampTzGetDatum(beentry->st_xact_start_timestamp); else nulls[8] = true;