explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dZt1

Settings
# exclusive inclusive rows x rows loops node
1. 0.043 3,230.123 ↑ 15.0 2 1

GroupAggregate (cost=308,828.22..308,829.42 rows=30 width=447) (actual time=3,230.111..3,230.123 rows=2 loops=1)

  • Group Key: v.id, vm.name, vtav.id, t.id, tm.name
  • Functions: 273
  • Options: Inlining false, Optimization false, Expressions true, Deforming true
  • Timing: Generation 27.058 ms, Inlining 0.000 ms, Optimization 15.557 ms, Emission 209.485 ms, Total 252.100 ms
2. 0.033 3,230.080 ↓ 1.3 40 1

Sort (cost=308,828.22..308,828.29 rows=30 width=511) (actual time=3,230.078..3,230.080 rows=40 loops=1)

  • Sort Key: v.id, vm.name, vtav.id, t.id, tm.name
  • Sort Method: quicksort Memory: 32kB
3. 0.073 3,230.047 ↓ 1.3 40 1

Hash Left Join (cost=162,219.68..308,827.48 rows=30 width=511) (actual time=1,905.449..3,230.047 rows=40 loops=1)

  • Hash Cond: (mrd.id = plan.id)
4. 4.479 1,825.100 ↓ 1.3 40 1

Merge Right Join (cost=114,764.82..261,372.54 rows=30 width=483) (actual time=500.517..1,825.100 rows=40 loops=1)

  • Merge Cond: (mrd_1.id = mrd.id)
5. 12.572 1,443.356 ↑ 1.2 48,787 1

Finalize GroupAggregate (cost=1,000.87..146,857.39 rows=60,062 width=36) (actual time=123.173..1,443.356 rows=48,787 loops=1)

  • Group Key: mrd_1.id
6. 214.509 1,430.784 ↓ 1.4 48,788 1

Gather Merge (cost=1,000.87..145,841.63 rows=35,331 width=36) (actual time=123.164..1,430.784 rows=48,788 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
7. 396.074 1,216.275 ↑ 1.4 24,502 2 / 2

Partial GroupAggregate (cost=0.86..140,866.89 rows=35,331 width=36) (actual time=73.361..1,216.275 rows=24,502 loops=2)

  • Group Key: mrd_1.id
8. 282.362 820.201 ↓ 9.6 340,759 2 / 2

Merge Left Join (cost=0.86..139,453.65 rows=35,331 width=36) (actual time=73.250..820.201 rows=340,759 loops=2)

  • Merge Cond: (mrd_1.id = w_1.month_request_data_id)
  • Join Filter: (date_part('month'::text, w_1.target_date) = (mr.month)::double precision)
  • Rows Removed by Join Filter: 8,140
9. 30.188 143.488 ↑ 1.4 24,504 2 / 2

Nested Loop Left Join (cost=0.43..14,824.41 rows=35,331 width=32) (actual time=68.953..143.488 rows=24,504 loops=2)

10. 88.797 88.797 ↑ 1.4 24,504 2 / 2

Parallel Index Scan using month_request_data_pkey on month_request_data mrd_1 (cost=0.29..9,170.56 rows=35,331 width=32) (actual time=68.901..88.797 rows=24,504 loops=2)

  • Filter: (deleted IS NULL)
  • Rows Removed by Filter: 2,028
11. 24.503 24.503 ↑ 1.0 1 49,007 / 2

Index Scan using month_request_pkey on month_request mr (cost=0.14..0.16 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=49,007)

  • Index Cond: (id = mrd_1.month_request_id)
  • Filter: (deleted IS NULL)
  • Rows Removed by Filter: 0
12. 394.351 394.351 ↑ 3.5 676,497 2 / 2

Index Scan using waybill_877358ce on waybill w_1 (cost=0.43..384,154.62 rows=2,374,264 width=20) (actual time=0.028..394.351 rows=676,497 loops=2)

  • Filter: ((accepted IS TRUE) AND (deleted IS NULL))
  • Rows Removed by Filter: 46,688
13. 0.050 377.265 ↓ 1.3 40 1

Sort (cost=113,763.94..113,764.02 rows=30 width=451) (actual time=377.258..377.265 rows=40 loops=1)

  • Sort Key: mrd.id
  • Sort Method: quicksort Memory: 32kB
14. 0.000 377.215 ↓ 1.3 40 1

Nested Loop Left Join (cost=6,221.76..113,763.21 rows=30 width=451) (actual time=93.333..377.215 rows=40 loops=1)

15. 49.907 398.508 ↓ 1.3 40 1

Gather (cost=6,221.61..113,758.31 rows=30 width=445) (actual time=93.322..398.508 rows=40 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
16. 0.019 348.601 ↓ 1.1 13 3 / 3

Nested Loop Left Join (cost=5,221.61..112,755.31 rows=12 width=445) (actual time=88.144..348.601 rows=13 loops=3)

17. 0.024 348.582 ↓ 1.1 13 3 / 3

Nested Loop Left Join (cost=5,221.33..112,738.84 rows=12 width=419) (actual time=88.140..348.582 rows=13 loops=3)

18. 0.024 348.558 ↓ 1.1 13 3 / 3

Nested Loop Left Join (cost=5,221.05..112,735.30 rows=12 width=351) (actual time=88.134..348.558 rows=13 loops=3)

19. 1.172 348.467 ↓ 1.1 13 3 / 3

Nested Loop (cost=5,220.77..112,731.42 rows=12 width=325) (actual time=88.102..348.467 rows=13 loops=3)

20. 2.010 341.848 ↓ 100.9 2,724 3 / 3

Parallel Hash Join (cost=5,220.49..112,723.56 rows=27 width=329) (actual time=59.373..341.848 rows=2,724 loops=3)

  • Hash Cond: ((w.month_request_data_id = mrd.id) AND (v.contractor_id = mrd.contractor_id) AND ((v.code)::text = (mrd.code)::text))
21. 56.812 330.180 ↑ 186.0 3,075 3 / 3

Parallel Hash Join (cost=1,968.93..104,966.69 rows=572,101 width=329) (actual time=49.488..330.180 rows=3,075 loops=3)

  • Hash Cond: (w.vehicle_id = v.id)
22. 224.135 224.135 ↑ 1.2 916,194 3 / 3

Parallel Seq Scan on waybill w (cost=0.00..99,994.02 rows=1,144,202 width=8) (actual time=0.040..224.135 rows=916,194 loops=3)

  • Filter: (deleted IS NULL)
  • Rows Removed by Filter: 24,905
23. 14.744 49.233 ↑ 218.0 83 3 / 3

Parallel Hash (cost=1,742.80..1,742.80 rows=18,090 width=325) (actual time=49.233..49.233 rows=83 loops=3)

  • Buckets: 32,768 Batches: 1 Memory Usage: 288kB
24. 34.489 34.489 ↑ 218.0 83 3 / 3

Parallel Seq Scan on vehicle v (cost=0.00..1,742.80 rows=18,090 width=325) (actual time=31.672..34.489 rows=83 loops=3)

  • Filter: smart_service
  • Rows Removed by Filter: 20,330
25. 4.896 9.658 ↑ 1.8 20,027 3 / 3

Parallel Hash (cost=2,633.28..2,633.28 rows=35,331 width=25) (actual time=9.658..9.658 rows=20,027 loops=3)

  • Buckets: 65,536 Batches: 1 Memory Usage: 4,288kB
26. 4.762 4.762 ↓ 1.7 60,080 1 / 3

Parallel Seq Scan on month_request_data mrd (cost=0.00..2,633.28 rows=35,331 width=25) (actual time=0.011..14.285 rows=60,080 loops=1)

  • Filter: (deleted IS NULL)
  • Rows Removed by Filter: 4,057
27. 5.447 5.447 ↓ 0.0 0 8,171 / 3

Index Scan using agreement_pkey on agreement a (cost=0.27..0.29 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=8,171)

  • Index Cond: (id = mrd.agreement_id)
  • Filter: ((deleted IS NULL) AND smart_service)
  • Rows Removed by Filter: 1
28. 0.067 0.067 ↑ 1.0 1 40 / 3

Index Scan using vehicle_model_pkey on vehicle_model vm (cost=0.29..0.32 rows=1 width=34) (actual time=0.005..0.005 rows=1 loops=40)

  • Index Cond: (id = v.vehicle_model_id)
  • Filter: (deleted IS NULL)
29. 0.000 0.000 ↓ 0.0 0 40 / 3

Index Scan using trailer_pkey on trailer t (cost=0.28..0.29 rows=1 width=68) (actual time=0.000..0.000 rows=0 loops=40)

  • Index Cond: (id = v.trailer_id)
  • Filter: (deleted IS NULL)
30. 0.000 0.000 ↓ 0.0 0 40 / 3

Index Scan using vehicle_model_pkey on vehicle_model tm (cost=0.29..1.37 rows=1 width=34) (actual time=0.000..0.000 rows=0 loops=40)

  • Index Cond: (id = t.vehicle_model_id)
  • Filter: (deleted IS NULL)
31. 0.040 0.040 ↑ 1.0 1 40

Index Scan using vehicle_type_attribute_value_pkey on vehicle_type_attribute_value vtav (cost=0.14..0.16 rows=1 width=10) (actual time=0.001..0.001 rows=1 loops=40)

  • Index Cond: (id = v.vehicle_type_attribute_value_id)
  • Filter: (deleted IS NULL)
32. 5.913 1,404.874 ↑ 1.3 45,327 1

Hash (cost=46,704.09..46,704.09 rows=60,062 width=36) (actual time=1,404.874..1,404.874 rows=45,327 loops=1)

  • Buckets: 65,536 Batches: 1 Memory Usage: 2,458kB
33. 3.026 1,398.961 ↑ 1.3 45,328 1

Subquery Scan on plan (cost=45,352.69..46,704.09 rows=60,062 width=36) (actual time=1,379.348..1,398.961 rows=45,328 loops=1)

34. 36.432 1,395.935 ↑ 1.3 45,328 1

Finalize HashAggregate (cost=45,352.69..46,103.47 rows=60,062 width=36) (actual time=1,379.346..1,395.935 rows=45,328 loops=1)

  • Group Key: mrd_2.id
35. 7.475 1,359.503 ↑ 2.7 45,328 1

Gather (cost=31,688.59..44,451.76 rows=120,124 width=36) (actual time=1,330.920..1,359.503 rows=45,328 loops=1)

  • Workers Planned: 2
  • Workers Launched: 0
36. 908.422 1,352.028 ↑ 1.3 45,328 1

Partial HashAggregate (cost=30,688.59..31,439.36 rows=60,062 width=36) (actual time=1,330.475..1,352.028 rows=45,328 loops=1)

  • Group Key: mrd_2.id
37. 279.846 443.606 ↓ 2.4 920,955 1

Parallel Hash Left Join (cost=3,074.91..16,311.12 rows=383,399 width=52) (actual time=30.847..443.606 rows=920,955 loops=1)

  • Hash Cond: (mrdd.month_request_data_id = mrd_2.id)
38. 133.406 133.406 ↓ 2.4 920,955 1

Parallel Seq Scan on month_request_data_day mrdd (cost=0.00..12,229.72 rows=383,399 width=28) (actual time=0.191..133.406 rows=920,955 loops=1)

  • Filter: (deleted IS NULL)
  • Rows Removed by Filter: 49,538
39. 12.144 30.354 ↓ 1.7 60,080 1

Parallel Hash (cost=2,633.28..2,633.28 rows=35,331 width=28) (actual time=30.354..30.354 rows=60,080 loops=1)

  • Buckets: 65,536 Batches: 1 Memory Usage: 4,288kB
40. 18.210 18.210 ↓ 1.7 60,080 1

Parallel Seq Scan on month_request_data mrd_2 (cost=0.00..2,633.28 rows=35,331 width=28) (actual time=0.019..18.210 rows=60,080 loops=1)

  • Filter: (deleted IS NULL)
  • Rows Removed by Filter: 4,057
Planning time : 11.290 ms
Execution time : 3,297.304 ms