lib/pghero/methods/query_stats.rb in pghero-2.0.2 vs lib/pghero/methods/query_stats.rb in pghero-2.0.3

- old
+ new

@@ -101,10 +101,12 @@ query_stats = {} mapping.each do |database_id, database_name| query_stats[database_id] = query_stats(limit: 1000000, database: database_name) end + supports_query_hash = supports_query_hash? + if query_stats.any? { |_, v| v.any? } && reset_query_stats query_stats.each do |db_id, db_query_stats| if db_query_stats.any? values = db_query_stats.map do |qs| @@ -112,10 +114,10 @@ db_id, qs[:query], qs[:total_minutes] * 60 * 1000, qs[:calls], now, - qs[:query_hash], + supports_query_hash ? qs[:query_hash] : nil, qs[:user] ] end columns = %w[database query total_time calls captured_at query_hash user]