explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7OIL

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

Gather (cost=32,045.20..43,749.37 rows=199 width=274) (actual rows= loops=)

  • Workers Planned: 2
2. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=31,045.20..42,729.47 rows=83 width=274) (actual rows= loops=)

  • Join Filter: (shift_brokers.broker_id = fleets.id)
  • Filter: ((fleets.type IS NULL) OR ((fleets.type)::text <> 'Broker'::text) OR (((fleets.type)::text = 'Broker'::text) AND ((shift_brokers.retender_sequence IS NULL) OR (shift_brokers.retender_sequence = 0))))
3. 0.000 0.000 ↓ 0.0

Parallel Hash Join (cost=31,044.91..42,695.99 rows=100 width=297) (actual rows= loops=)

  • Hash Cond: (timesheets_v2_customer_transactions.id = v2_timesheets.id)
4. 0.000 0.000 ↓ 0.0

Hash Join (cost=22,468.22..34,030.91 rows=23,456 width=301) (actual rows= loops=)

  • Hash Cond: (timesheets_v2_customer_transactions.job_site_id = job_sites.id)
5. 0.000 0.000 ↓ 0.0

Hash Join (cost=21,355.44..32,856.54 rows=23,456 width=309) (actual rows= loops=)

  • Hash Cond: (jobs_shifts.customer_id = customers.id)
6. 0.000 0.000 ↓ 0.0

Parallel Hash Join (cost=21,227.76..32,667.16 rows=23,456 width=313) (actual rows= loops=)

  • Hash Cond: (shifts_v2_timesheets.job_id = jobs_shifts.id)
7. 0.000 0.000 ↓ 0.0

Parallel Hash Join (cost=16,859.20..28,237.03 rows=23,456 width=313) (actual rows= loops=)

  • Hash Cond: (shifts_v2_timesheets.id = timesheets_v2_customer_transactions.shift_id)
8. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on shifts shifts_v2_timesheets (cost=0.00..10,938.35 rows=91,135 width=8) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=16,566.00..16,566.00 rows=23,456 width=317) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Parallel Hash Join (cost=12,117.66..16,566.00 rows=23,456 width=317) (actual rows= loops=)

  • Hash Cond: (v2_customer_transactions.v2_timesheet_id = timesheets_v2_customer_transactions.id)
11. 0.000 0.000 ↓ 0.0

Hash Join (cost=6,465.29..10,852.06 rows=23,456 width=293) (actual rows= loops=)

  • Hash Cond: (v2_earnings.fleet_id = fleets.id)
12. 0.000 0.000 ↓ 0.0

Parallel Hash Join (cost=6,236.19..10,548.14 rows=28,466 width=282) (actual rows= loops=)

  • Hash Cond: (v2_earnings.id = v2_customer_transactions.v2_earning_id)
13. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on v2_earnings (cost=0.00..3,995.76 rows=52,690 width=16) (actual rows= loops=)

  • Filter: ((fleet_approval_status <> 0) OR (fleet_approval_status IS NULL))
14. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=5,880.29..5,880.29 rows=28,472 width=274) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on v2_customer_transactions (cost=0.00..5,880.29 rows=28,472 width=274) (actual rows= loops=)

  • Filter: ((NOT exported) AND (created_at >= '2019-01-01 00:00:00'::timestamp without time zone) AND (((type)::text = 'V2::AdjustmentTransaction'::text) OR (price_per_unit_cents = 0)))
16. 0.000 0.000 ↓ 0.0

Hash (cost=193.64..193.64 rows=2,837 width=19) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Seq Scan on fleets (cost=0.00..193.64 rows=2,837 width=19) (actual rows= loops=)

  • Filter: ((type IS NULL) OR ((type)::text <> 'Broker'::text) OR ((type)::text = 'Broker'::text))
18. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=4,972.72..4,972.72 rows=54,372 width=24) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on v2_timesheets timesheets_v2_customer_transactions (cost=0.00..4,972.72 rows=54,372 width=24) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=4,105.47..4,105.47 rows=21,047 width=8) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on jobs jobs_shifts (cost=0.00..4,105.47 rows=21,047 width=8) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Hash (cost=101.75..101.75 rows=2,075 width=4) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Seq Scan on customers (cost=0.00..101.75 rows=2,075 width=4) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Hash (cost=952.90..952.90 rows=12,790 width=4) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Seq Scan on job_sites (cost=0.00..952.90 rows=12,790 width=4) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=8,573.79..8,573.79 rows=232 width=12) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.84..8,573.79 rows=232 width=12) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..8,190.11 rows=715 width=4) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on jobs (cost=0.00..4,158.08 rows=165 width=4) (actual rows= loops=)

  • Filter: (customer_id = 563)
30. 0.000 0.000 ↓ 0.0

Index Scan using index_shifts_on_job_id on shifts (cost=0.42..24.36 rows=8 width=8) (actual rows= loops=)

  • Index Cond: (job_id = jobs.id)
31. 0.000 0.000 ↓ 0.0

Index Scan using index_v2_timesheets_on_shift_id on v2_timesheets (cost=0.42..0.53 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (shift_id = shifts.id)
  • Filter: ((id IS NULL) OR ((status)::text = ANY ('{approved,invoiced}'::text[])))
32. 0.000 0.000 ↓ 0.0

Index Scan using index_shift_brokers_on_shift_id on shift_brokers (cost=0.29..0.31 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (shift_id = shifts.id)