explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ciuI

Settings
# exclusive inclusive rows x rows loops node
1. 0.027 2,897.164 ↓ 0.0 0 1

Sort (cost=139,369.52..139,392.84 rows=9,328 width=62) (actual time=2,897.164..2,897.164 rows=0 loops=1)

  • Sort Key: n.name, (COALESCE(u.name, 'SYSTEM'::character varying))
  • Sort Method: quicksort Memory: 25kB
2. 0.011 2,897.137 ↓ 0.0 0 1

Hash Join (cost=59,615.96..138,754.46 rows=9,328 width=62) (actual time=2,897.137..2,897.137 rows=0 loops=1)

  • Hash Cond: (a.account_type_id = at.id)
3. 1,107.750 2,897.097 ↓ 0.0 0 1

Hash Join (cost=59,612.79..138,623.03 rows=9,328 width=31) (actual time=2,897.097..2,897.097 rows=0 loops=1)

  • Hash Cond: (a.id = transfers_1.to_id)
  • Join Filter: (account_balance(a.id, NULL::timestamp with time zone) <> ((sum(transfers_1.amount)) - (sum(transfers.amount))))
  • Rows Removed by Join Filter: 32896
4. 15.021 1,131.730 ↓ 1.2 32,897 1

Hash Left Join (cost=1,875.92..80,813.35 rows=27,640 width=71) (actual time=22.423..1,131.730 rows=32,897 loops=1)

  • Hash Cond: (a.user_id = u.id)
5. 16.749 1,105.633 ↓ 1.2 32,897 1

Merge Join (cost=0.72..78,865.57 rows=27,640 width=64) (actual time=11.167..1,105.633 rows=32,897 loops=1)

  • Merge Cond: (a.id = transfers.from_id)
6. 17.057 17.057 ↑ 1.0 32,899 1

Index Scan using accounts_pkey on accounts a (cost=0.29..935.58 rows=32,899 width=24) (actual time=0.014..17.057 rows=32,899 loops=1)

7. 1,071.827 1,071.827 ↓ 1.2 32,897 1

GroupAggregate (cost=0.43..77,225.85 rows=27,640 width=40) (actual time=11.149..1,071.827 rows=32,897 loops=1)

  • Group Key: transfers.from_id
  • -> Index Scan using ix_transfers_fk_transfers_from_id on transfers (cost=0.43..67084.25 rows=1959220 width=13) (actual time=0.069..807.
8. 4.814 11.076 ↑ 1.0 32,898 1

Hash (cost=1,463.98..1,463.98 rows=32,898 width=23) (actual time=11.076..11.076 rows=32,898 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 2312kB
9. 6.262 6.262 ↑ 1.0 32,898 1

Seq Scan on users u (cost=0.00..1,463.98 rows=32,898 width=23) (actual time=0.006..6.262 rows=32,898 loops=1)

10. 4.262 657.617 ↓ 2.9 32,898 1

Hash (cost=57,597.38..57,597.38 rows=11,159 width=40) (actual time=657.617..657.617 rows=32,898 loops=1)

  • Buckets: 65536 (originally 16384) Batches: 1 (originally 1) Memory Usage: 2022kB
11. 557.059 653.355 ↓ 2.9 32,898 1

HashAggregate (cost=57,346.30..57,485.79 rows=11,159 width=40) (actual time=640.488..653.355 rows=32,898 loops=1)

  • Group Key: transfers_1.to_id
12. 96.296 96.296 ↑ 1.0 1,959,220 1

Seq Scan on transfers transfers_1 (cost=0.00..47,550.20 rows=1,959,220 width=13) (actual time=0.004..96.296 rows=1,959,220 loops=1)

13. 0.004 0.029 ↑ 1.0 4 1

Hash (cost=3.12..3.12 rows=4 width=30) (actual time=0.029..0.029 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
14. 0.004 0.025 ↑ 1.0 4 1

Nested Loop (cost=0.00..3.12 rows=4 width=30) (actual time=0.022..0.025 rows=4 loops=1)

  • Join Filter: (c.id = at.currency_id)
15. 0.004 0.018 ↑ 1.0 1 1

Nested Loop (cost=0.00..2.03 rows=1 width=16) (actual time=0.018..0.018 rows=1 loops=1)

  • Join Filter: (c.network_id = n.id)
16. 0.006 0.006 ↑ 1.0 1 1

Seq Scan on currencies c (cost=0.00..1.01 rows=1 width=16) (actual time=0.005..0.006 rows=1 loops=1)

17. 0.008 0.008 ↑ 1.0 1 1

Seq Scan on networks n (cost=0.00..1.01 rows=1 width=16) (actual time=0.008..0.008 rows=1 loops=1)

18. 0.003 0.003 ↑ 1.0 4 1

Seq Scan on account_types at (cost=0.00..1.04 rows=4 width=30) (actual time=0.002..0.003 rows=4 loops=1)

Planning time : 3.339 ms
Execution time : 2,898.846 ms