explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5ymx

Settings
# exclusive inclusive rows x rows loops node
1. 0.624 2,633.298 ↑ 581.3 18 1

HashAggregate (cost=537,234.48..537,365.27 rows=10,463 width=100) (actual time=2,633.261..2,633.298 rows=18 loops=1)

  • Group Key: d.id, d.plan_shifts
  • Functions: 57
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 11.281 ms, Inlining 11.919 ms, Optimization 438.743 ms, Emission 272.163 ms, Total 734.106 ms
2. 33.066 2,632.674 ↑ 197.0 531 1

Merge Right Join (cost=498,173.39..534,095.52 rows=104,632 width=68) (actual time=2,629.143..2,632.674 rows=531 loops=1)

  • Merge Cond: ((w.month_request_data_id = d.id) AND ((date_part('month'::text, w.target_date)) = ((d.month)::double precision)))
3. 1,053.610 2,584.327 ↑ 4.4 628,345 1

Sort (cost=466,472.55..473,337.76 rows=2,746,084 width=20) (actual time=2,517.957..2,584.327 rows=628,345 loops=1)

  • Sort Key: w.month_request_data_id, (date_part('month'::text, w.target_date))
  • Sort Method: external merge Disk: 95,328kB
4. 1,530.717 1,530.717 ↓ 1.0 2,748,583 1

Seq Scan on waybill w (cost=0.00..116,474.86 rows=2,746,084 width=20) (actual time=723.778..1,530.717 rows=2,748,583 loops=1)

  • Filter: (deleted IS NULL)
  • Rows Removed by Filter: 74,715
5. 0.052 15.281 ↑ 202.4 517 1

Sort (cost=31,700.84..31,962.42 rows=104,632 width=64) (actual time=15.246..15.281 rows=517 loops=1)

  • Sort Key: d.id, ((d.month)::double precision)
  • Sort Method: quicksort Memory: 27kB
6. 0.005 15.229 ↑ 5,812.9 18 1

Subquery Scan on d (cost=20,622.95..22,977.17 rows=104,632 width=64) (actual time=14.894..15.229 rows=18 loops=1)

7. 0.876 15.224 ↑ 5,812.9 18 1

HashAggregate (cost=20,622.95..21,930.85 rows=104,632 width=64) (actual time=14.891..15.224 rows=18 loops=1)

  • Group Key: mrd.id, mr.month
8. 0.059 14.348 ↑ 199.3 525 1

Nested Loop (cost=23.85..16,437.67 rows=104,632 width=56) (actual time=7.167..14.348 rows=525 loops=1)

9. 0.314 14.029 ↑ 364.6 20 1

Hash Join (cost=23.42..3,125.85 rows=7,293 width=32) (actual time=7.133..14.029 rows=20 loops=1)

  • Hash Cond: (mrd.agreement_id = a.id)
10. 6.301 13.648 ↑ 3.8 4,000 1

Hash Join (cost=2.78..3,064.63 rows=15,322 width=36) (actual time=1.668..13.648 rows=4,000 loops=1)

  • Hash Cond: (mrd.month_request_id = mr.id)
11. 7.329 7.329 ↓ 1.0 60,080 1

Seq Scan on month_request_data mrd (cost=0.00..2,897.37 rows=60,062 width=36) (actual time=0.017..7.329 rows=60,080 loops=1)

  • Filter: (deleted IS NULL)
  • Rows Removed by Filter: 4,057
12. 0.005 0.018 ↑ 3.1 8 1

Hash (cost=2.47..2.47 rows=25 width=8) (actual time=0.018..0.018 rows=8 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
13. 0.013 0.013 ↑ 3.1 8 1

Seq Scan on month_request mr (cost=0.00..2.47 rows=25 width=8) (actual time=0.011..0.013 rows=8 loops=1)

  • Filter: ((deleted IS NULL) AND (date_start <= '2020-06-10'::date) AND (date_end > '2020-06-10'::date))
  • Rows Removed by Filter: 90
14. 0.003 0.067 ↑ 57.0 4 1

Hash (cost=17.79..17.79 rows=228 width=4) (actual time=0.067..0.067 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
15. 0.064 0.064 ↑ 57.0 4 1

Seq Scan on agreement a (cost=0.00..17.79 rows=228 width=4) (actual time=0.062..0.064 rows=4 loops=1)

  • Filter: ((deleted IS NULL) AND (smart_service IS TRUE))
  • Rows Removed by Filter: 439
16. 0.260 0.260 ↓ 1.1 26 20

Index Scan using month_request_data_day_877358ce on month_request_data_day mrdd (cost=0.42..1.59 rows=24 width=28) (actual time=0.005..0.013 rows=26 loops=20)

  • Index Cond: (month_request_data_id = mrd.id)
  • Filter: (deleted IS NULL)
Planning time : 1.710 ms
Execution time : 2,661.755 ms