lib/dexter/indexer.rb in pgdexter-0.4.1 vs lib/dexter/indexer.rb in pgdexter-0.4.2
- old
+ new
@@ -618,19 +618,20 @@
view_tables
end
def stat_statements
+ total_time = server_version_num >= 130000 ? "(total_plan_time + total_exec_time)" : "total_time"
result = execute <<-SQL
SELECT
DISTINCT query
FROM
pg_stat_statements
INNER JOIN
pg_database ON pg_database.oid = pg_stat_statements.dbid
WHERE
datname = current_database()
- AND total_time >= #{@min_time * 60000}
+ AND #{total_time} >= #{@min_time * 60000}
AND calls >= #{@min_calls}
ORDER BY
1
SQL
result.map { |q| q["query"] }