Skip to content

Commit

Permalink
simplify output
Browse files Browse the repository at this point in the history
  • Loading branch information
6 committed Oct 27, 2017
1 parent 6fd90a7 commit 1641da3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -10,7 +10,7 @@ Wallet.where(base_currency: "USD").explain(analyze: true)
Results in:

```sql
EXPLAIN (ANALYZE COSTS VERBOSE BUFFERS FORMAT TEXT) for: SELECT "wallets".* FROM "wallets" WHERE "wallets"."deleted_at" IS NULL AND "wallets"."base_currency" = $1
EXPLAIN for: SELECT "wallets".* FROM "wallets" WHERE "wallets"."deleted_at" IS NULL AND "wallets"."base_currency" = $1
Bitmap Heap Scan on public.wallets (cost=4.16..9.50 rows=1 width=164) (actual time=0.008..0.012 rows=30 loops=1)
Output: id, canonical_id, client_id, wallet_type, base_currency, created_at, updated_at, deleted_at
Recheck Cond: (wallets.deleted_at IS NULL)
Expand Down
5 changes: 1 addition & 4 deletions lib/activerecord-explain-analyze/relation.rb
Expand Up @@ -23,10 +23,7 @@ def explain(analyze: false, format: :text)

def exec_explain_with_options(queries, analyze:, format:)
str = queries.map do |sql, binds|
msg = "EXPLAIN ("
msg << "ANALYZE COSTS VERBOSE BUFFERS " if analyze
msg << "FORMAT #{format})"
msg << " for: #{sql}\n".dup
msg = "EXPLAIN for: #{sql}\n".dup
msg << connection.explain_with_options(sql, binds, analyze, format)
end.join("\n")

Expand Down

0 comments on commit 1641da3

Please sign in to comment.