Skip to content

Commit

Permalink
Check current query stats for explainable query [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jan 5, 2023
1 parent 026508c commit e981247
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/pghero/methods/query_stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def current_query_stats(limit: nil, sort: nil, database: nil, query_hash: nil)
)
SELECT
query,
query AS explainable_query,
query_hash,
query_stats.user,
total_minutes,
Expand All @@ -243,7 +244,7 @@ def current_query_stats(limit: nil, sort: nil, database: nil, query_hash: nil)
# we may be able to skip query_columns
# in more recent versions of Postgres
# as pg_stat_statements should be already normalized
select_all(query, query_columns: [:query])
select_all(query, query_columns: [:query, :explainable_query])
else
raise NotEnabled, "Query stats not enabled"
end
Expand Down

0 comments on commit e981247

Please sign in to comment.