lib/postgres/vacuum/monitor/query.rb in postgres-vacuum-monitor-0.4.0 vs lib/postgres/vacuum/monitor/query.rb in postgres-vacuum-monitor-0.5.0
- old
+ new
@@ -9,19 +9,20 @@
THRESHOLD_SETTING = "'autovacuum_vacuum_threshold'".freeze
SCALE_FACTOR_SETTING = "'autovacuum_vacuum_scale_factor'".freeze
MAX_AGE_SETTING = "'autovacuum_freeze_max_age'".freeze
PG_CATALOG = "'pg_catalog'".freeze
- def long_running_queries
+ def long_running_transactions
<<-SQL
SELECT *
FROM (
SELECT
pid,
xact_start,
EXTRACT(EPOCH FROM (now() - xact_start)) AS seconds,
application_name,
- query
+ query,
+ state
FROM pg_stat_activity
WHERE state IN (#{STATES.join(', ')})
ORDER BY seconds DESC
) AS long_queries
WHERE seconds > #{TIME_LIMIT};