explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wOUw

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 0.046 ↑ 1.0 1 1

Aggregate (cost=39.49..39.50 rows=1 width=8) (actual time=0.045..0.046 rows=1 loops=1)

2. 0.021 0.040 ↓ 0.0 0 1

Hash Semi Join (cost=38.34..39.49 rows=1 width=8) (actual time=0.040..0.040 rows=0 loops=1)

  • Hash Cond: (users.id = q.accounts_user_id)
3. 0.007 0.007 ↑ 11.0 1 1

Seq Scan on users (cost=0.00..1.11 rows=11 width=8) (actual time=0.007..0.007 rows=1 loops=1)

4. 0.001 0.012 ↓ 0.0 0 1

Hash (cost=38.33..38.33 rows=1 width=8) (actual time=0.012..0.012 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
5. 0.000 0.011 ↓ 0.0 0 1

Subquery Scan on q (cost=38.18..38.33 rows=1 width=8) (actual time=0.011..0.011 rows=0 loops=1)

6. 0.000 0.011 ↓ 0.0 0 1

GroupAggregate (cost=38.18..38.32 rows=1 width=80) (actual time=0.011..0.011 rows=0 loops=1)

  • Group Key: accounts.id
  • Filter: (((((((- (COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'bet'::text)), '0'::numeric) + COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'win'::text)), '0'::numeric))) + COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'issued_bonus'::text)), '0'::numeric)) - COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'canceled_bonus'::text)), '0'::numeric)) + COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'addition'::text)), '0'::numeric)) - COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'subtraction'::text)), '0'::numeric)) >= '-50000000000000'::numeric) AND ((((((- (COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'bet'::text)), '0'::numeric) + COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'win'::text)), '0'::numeric))) + COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'issued_bonus'::text)), '0'::numeric)) - COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'canceled_bonus'::text)), '0'::numeric)) + COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'addition'::text)), '0'::numeric)) - COALESCE(sum(dense_balance_transactions.amount_cents) FILTER (WHERE ((dense_balance_transactions.action)::text = 'subtraction'::text)), '0'::numeric)) <= '50000000000000'::numeric))
7. 0.003 0.011 ↓ 0.0 0 1

Sort (cost=38.18..38.18 rows=1 width=88) (actual time=0.011..0.011 rows=0 loops=1)

  • Sort Key: accounts.id
  • Sort Method: quicksort Memory: 25kB
8. 0.000 0.008 ↓ 0.0 0 1

Hash Join (cost=18.76..38.17 rows=1 width=88) (actual time=0.008..0.008 rows=0 loops=1)

  • Hash Cond: (accounts.id = dense_balance_transactions.account_id)
9. 0.008 0.008 ↓ 0.0 0 1

Seq Scan on accounts (cost=0.00..19.38 rows=4 width=48) (actual time=0.008..0.008 rows=0 loops=1)

  • Filter: ((currency)::text = 'RUB'::text)
  • Rows Removed by Filter: 26
10. 0.000 0.000 ↓ 0.0 0

Hash (cost=18.58..18.58 rows=15 width=48) (never executed)

11. 0.000 0.000 ↓ 0.0 0

Seq Scan on dense_balance_transactions (cost=0.00..18.58 rows=15 width=48) (never executed)

  • Filter: ((action)::text = ANY ('{bet,win,issued_bonus,canceled_bonus,addition,subtraction}'::text[]))
Planning time : 0.651 ms
Execution time : 0.160 ms