lib/pghero/methods/explain.rb in pghero-3.3.4 vs lib/pghero/methods/explain.rb in pghero-3.4.0
- old
+ new
@@ -10,22 +10,23 @@
# use transaction for safety
with_transaction(statement_timeout: (explain_timeout_sec * 1000).round, rollback: true) do
if (sql.sub(/;\z/, "").include?(";") || sql.upcase.include?("COMMIT")) && !explain_safe?
raise ActiveRecord::StatementInvalid, "Unsafe statement"
end
- explanation = select_all("EXPLAIN #{sql}").map { |v| v[:"QUERY PLAN"] }.join("\n")
+ explanation = execute("EXPLAIN #{sql}").map { |v| v["QUERY PLAN"] }.join("\n")
end
explanation
end
# TODO rename to explain in 4.0
# note: this method is not affected by the explain option
- def explain_v2(sql, analyze: nil, verbose: nil, costs: nil, settings: nil, buffers: nil, wal: nil, timing: nil, summary: nil, format: "text")
+ def explain_v2(sql, analyze: nil, verbose: nil, costs: nil, settings: nil, generic_plan: nil, buffers: nil, wal: nil, timing: nil, summary: nil, format: "text")
options = []
add_explain_option(options, "ANALYZE", analyze)
add_explain_option(options, "VERBOSE", verbose)
add_explain_option(options, "SETTINGS", settings)
+ add_explain_option(options, "GENERIC_PLAN", generic_plan)
add_explain_option(options, "COSTS", costs)
add_explain_option(options, "BUFFERS", buffers)
add_explain_option(options, "WAL", wal)
add_explain_option(options, "TIMING", timing)
add_explain_option(options, "SUMMARY", summary)