explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7JLV

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

HashAggregate (cost=6,798,749.38..6,798,752.38 rows=200 width=88) (actual rows= loops=)

  • Group Key: r.transaction_date, r.ledger_account_id, r.portfolio_enum
2.          

CTE entries

3. 0.000 0.000 ↓ 0.0

Unique (cost=837,090.96..852,595.52 rows=200 width=28) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Sort (cost=837,090.96..844,843.24 rows=3,100,912 width=28) (actual rows= loops=)

  • Sort Key: journal_entries.id, journal_entries.version DESC
5. 0.000 0.000 ↓ 0.0

Seq Scan on journal_entries (cost=0.00..354,360.58 rows=3,100,912 width=28) (actual rows= loops=)

  • Filter: (transaction_date < ((timezone('AEST'::text, now()))::date - 1))
6.          

CTE recordings

7. 0.000 0.000 ↓ 0.0

Unique (cost=5,853,596.80..5,946,146.36 rows=200 width=80) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Sort (cost=5,853,596.80..5,899,871.58 rows=18,509,912 width=80) (actual rows= loops=)

  • Sort Key: r_1.id, r_1.version DESC
9. 0.000 0.000 ↓ 0.0

Hash Join (cost=6.50..1,151,889.32 rows=18,509,912 width=80) (actual rows= loops=)

  • Hash Cond: (r_1.journal_entry_id = e.id)
10. 0.000 0.000 ↓ 0.0

Seq Scan on journal_entry_recordings r_1 (cost=0.00..457,761.12 rows=18,509,912 width=88) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Hash (cost=4.00..4.00 rows=200 width=24) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

CTE Scan on entries e (cost=0.00..4.00 rows=200 width=24) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

CTE Scan on recordings r (cost=0.00..4.00 rows=200 width=60) (actual rows= loops=)