explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jBt5

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

Nested Loop Left Join (cost=5,620,438.10..206,437,962.84 rows=21,743,466 width=391) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=5,620,437.54..145,067,030.05 rows=21,743,466 width=233) (actual rows= loops=)

  • Hash Cond: ((party_attributes.id = account_attributes.party_id) AND ((roll.account_id)::text = (account_attributes.id)::text))
3. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=5,620,392.03..144,902,804.30 rows=21,743,466 width=204) (actual rows= loops=)

  • Hash Cond: (roll.party_id = party_attributes.id)
4. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=5,620,389.64..144,603,829.25 rows=21,743,466 width=186) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=5,620,388.51..22,786,060.99 rows=21,743,466 width=168) (actual rows= loops=)

  • Hash Cond: (inventory_log.event_id = inventory_log_event.id)
6. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=5,620,385.58..22,487,085.41 rows=21,743,466 width=145) (actual rows= loops=)

  • Hash Cond: (roll.inventory_id = inv.id)
7. 0.000 0.000 ↓ 0.0

Merge Right Join (cost=5,577,992.43..22,145,719.60 rows=21,743,466 width=58) (actual rows= loops=)

  • Merge Cond: ((inventory_log.id = roll.inventory_log_id) AND (inventory_log.inventory_id = roll.inventory_id))
8. 0.000 0.000 ↓ 0.0

Index Scan using inventory_log_pkey on inventory_log (cost=0.57..17,223,201.51 rows=258,077,757 width=14) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Sort (cost=3,468,215.69..3,522,574.35 rows=21,743,466 width=52) (actual rows= loops=)

  • Sort Key: roll.inventory_log_id, roll.inventory_id
10. 0.000 0.000 ↓ 0.0

Index Scan using inventory_roll_table_created on inventory_roll_table roll (cost=0.58..818,330.94 rows=21,743,466 width=52) (actual rows= loops=)

  • Index Cond: (created >= timezone('EST5EDT'::text, timezone('UTC'::text, date_trunc('month'::text, (now() - '6 mons'::interval)))))
11. 0.000 0.000 ↓ 0.0

Hash (cost=32,575.20..32,575.20 rows=785,436 width=91) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=92.10..32,575.20 rows=785,436 width=91) (actual rows= loops=)

  • Hash Cond: (inv.inventory_location_id = inventory_location.id)
13. 0.000 0.000 ↓ 0.0

Seq Scan on inventory inv (cost=0.00..21,683.36 rows=785,436 width=16) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Hash (cost=73.71..73.71 rows=1,471 width=83) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=28.77..73.71 rows=1,471 width=83) (actual rows= loops=)

  • Hash Cond: (inventory_location.facility_id = facility.id)
16. 0.000 0.000 ↓ 0.0

Seq Scan on inventory_location (cost=0.00..24.71 rows=1,471 width=71) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Hash (cost=25.01..25.01 rows=301 width=20) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Seq Scan on facility (cost=0.00..25.01 rows=301 width=20) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Hash (cost=2.41..2.41 rows=41 width=27) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Seq Scan on inventory_log_event (cost=0.00..2.41 rows=41 width=27) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Limit (cost=1.14..5.58 rows=1 width=26) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.14..5.58 rows=1 width=26) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Index Scan Backward using inventory_valuation_amount_table_pkey on inventory_valuation_amount_table a (cost=0.57..2.79 rows=1 width=34) (actual rows= loops=)

  • Index Cond: (id = roll.id)
24. 0.000 0.000 ↓ 0.0

Index Scan using inventory_valuation_table_pkey on inventory_valuation_table v (cost=0.57..2.79 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = roll.id)
  • Filter: (party_id = roll.party_id)
25. 0.000 0.000 ↓ 0.0

Hash (cost=2.28..2.28 rows=9 width=22) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Subquery Scan on party_attributes (cost=2.04..2.28 rows=9 width=22) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Unique (cost=2.04..2.19 rows=9 width=1,197) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Sort (cost=2.04..2.11 rows=30 width=1,197) (actual rows= loops=)

  • Sort Key: party_attributes_table.id, party_attributes_table.created DESC
29. 0.000 0.000 ↓ 0.0

Seq Scan on party_attributes_table (cost=0.00..1.30 rows=30 width=1,197) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Hash (cost=43.06..43.06 rows=163 width=45) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Subquery Scan on account_attributes (cost=0.28..43.06 rows=163 width=45) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Unique (cost=0.28..41.43 rows=163 width=526) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Index Scan using account_attributes_table_party_id_id_created_idx on account_attributes_table (cost=0.28..37.12 rows=862 width=526) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Limit (cost=0.57..2.79 rows=1 width=25) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Index Scan Backward using inventory_log_amount_pkey on inventory_log_amount ila (cost=0.57..2.79 rows=1 width=25) (actual rows= loops=)

  • Index Cond: ((id = roll.inventory_log_id) AND (inventory_id = roll.inventory_id))