explain.depesz.com

PostgreSQL's explain analyze made readable

Result: afB1

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)
33. 0.000 0.000 ↓ 0.0

Index Scan using associates_pkey on associates (cost=0.28..8.29 rows=1 width=632) (actual rows= loops=)

  • Index Cond: (id = 1,313)
34. 0.000 0.000 ↓ 0.0

Index Scan using v2_earnings_pkey on v2_earnings (cost=0.42..70.23 rows=9 width=224) (actual rows= loops=)

  • Index Cond: (id = ANY ('{137958,137960,137959,137954,137956,137952,137951,137953,137957}'::bigint[]))
35. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on fleets (cost=21.73..42.13 rows=6 width=524) (actual rows= loops=)

  • Recheck Cond: (id = ANY ('{3287,3855,3373,3418,3339,3148}'::integer[]))
36. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on fleets_pkey (cost=0.00..21.73 rows=6 width=0) (actual rows= loops=)

  • Index Cond: (id = ANY ('{3287,3855,3373,3418,3339,3148}'::integer[]))
37. 0.000 0.000 ↓ 0.0

Index Scan using v2_timesheets_pkey on v2_timesheets (cost=0.42..51.08 rows=7 width=332) (actual rows= loops=)

  • Index Cond: (id = ANY ('{124294,124101,124281,124286,124236,124328,124321}'::bigint[]))
38. 0.000 0.000 ↓ 0.0

Index Scan using shifts_pkey on shifts (cost=0.42..51.94 rows=7 width=636) (actual rows= loops=)

  • Index Cond: (id = ANY ('{241421,241415,241417,241418,241420,241419,241416}'::integer[]))
39. 0.000 0.000 ↓ 0.0

Index Scan using customers_pkey on customers (cost=0.28..8.30 rows=1 width=659) (actual rows= loops=)

  • Index Cond: (id = 563)
40. 0.000 0.000 ↓ 0.0

Index Scan using job_sites_pkey on job_sites (cost=0.29..8.30 rows=1 width=649) (actual rows= loops=)

  • Index Cond: (id = 13,057)
41. 0.000 0.000 ↓ 0.0

Index Scan using trucks_pkey on trucks (cost=0.29..38.56 rows=7 width=170) (actual rows= loops=)

  • Index Cond: (id = ANY ('{8162,8539,9833,9047,9417,9048,9962}'::integer[]))
42. 0.000 0.000 ↓ 0.0

Seq Scan on truck_types (cost=0.00..1.98 rows=1 width=56) (actual rows= loops=)

  • Filter: (id = 3)
43. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on fleets (cost=21.73..42.13 rows=6 width=524) (actual rows= loops=)

  • Recheck Cond: (id = ANY ('{3148,3287,3373,3418,3339,3855}'::integer[]))
44. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on fleets_pkey (cost=0.00..21.73 rows=6 width=0) (actual rows= loops=)

  • Index Cond: (id = ANY ('{3148,3287,3373,3418,3339,3855}'::integer[]))
45. 0.000 0.000 ↓ 0.0

Index Scan using jobs_pkey on jobs (cost=0.29..8.31 rows=1 width=795) (actual rows= loops=)

  • Index Cond: (id = 54,980)
46. 0.000 0.000 ↓ 0.0

Index Scan using job_sites_pkey on job_sites (cost=0.29..8.30 rows=1 width=649) (actual rows= loops=)

  • Index Cond: (id = 13,057)
47. 0.000 0.000 ↓ 0.0

Index Scan using index_rate_overrides_business_entityable_type_and_id on rate_overrides (cost=0.29..8.31 rows=1 width=158) (actual rows= loops=)

  • Index Cond: (((business_entityable_type)::text = 'Job'::text) AND (business_entityable_id = 54,980))
48. 0.000 0.000 ↓ 0.0

Index Scan using job_sites_pkey on job_sites (cost=0.29..8.30 rows=1 width=649) (actual rows= loops=)

  • Index Cond: (id = 5,498)
49. 0.000 0.000 ↓ 0.0

Index Scan using job_sites_pkey on job_sites (cost=0.29..8.30 rows=1 width=649) (actual rows= loops=)

  • Index Cond: (id = 13,057)
50. 0.000 0.000 ↓ 0.0

Index Scan using customers_pkey on customers (cost=0.28..8.30 rows=1 width=659) (actual rows= loops=)

  • Index Cond: (id = 563)
51. 0.000 0.000 ↓ 0.0

Index Scan using index_material_orders_on_job_id on material_orders (cost=0.29..8.30 rows=1 width=346) (actual rows= loops=)

  • Index Cond: (job_id = 54,980)
52. 0.000 0.000 ↓ 0.0

Index Scan using associates_pkey on associates (cost=0.28..8.29 rows=1 width=632) (actual rows= loops=)

  • Index Cond: (id = 1,194)
53. 0.000 0.000 ↓ 0.0

Sort (cost=8.31..8.32 rows=1 width=119) (actual rows= loops=)

  • Sort Key: id
54. 0.000 0.000 ↓ 0.0

Index Scan using index_material_order_items_on_material_order_id on material_order_items (cost=0.29..8.30 rows=1 width=119) (actual rows= loops=)

  • Index Cond: (material_order_id = 25,694)
55. 0.000 0.000 ↓ 0.0

Index Scan using items_pkey on items (cost=0.29..8.31 rows=1 width=81) (actual rows= loops=)

  • Index Cond: (id = 26,824)