diff --git a/collector/pg_long_running_transactions.go b/collector/pg_long_running_transactions.go index ffd89d5f0..1f0b76f9e 100644 --- a/collector/pg_long_running_transactions.go +++ b/collector/pg_long_running_transactions.go @@ -52,7 +52,7 @@ var ( longRunningTransactionsQuery = ` SELECT COUNT(*) as transactions, - MAX(EXTRACT(EPOCH FROM clock_timestamp())) AS oldest_timestamp_seconds + MIN(EXTRACT(EPOCH FROM xact_start)) AS oldest_timestamp_seconds FROM pg_catalog.pg_stat_activity WHERE state is distinct from 'idle' AND query not like 'autovacuum:%' `