explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 8yuC

Settings
# exclusive inclusive rows x rows loops node
1. 0.725 2,152.825 ↑ 581.3 18 1

HashAggregate (cost=482,665.29..482,796.07 rows=10,463 width=100) (actual time=2,152.786..2,152.825 rows=18 loops=1)

  • Group Key: d.id, d.plan_shifts
  • Functions: 57
  • Options: Inlining false, Optimization false, Expressions true, Deforming true
  • Timing: Generation 6.210 ms, Inlining 0.000 ms, Optimization 2.861 ms, Emission 43.496 ms, Total 52.567 ms
2. 44.539 2,152.100 ↑ 198.5 527 1

Merge Right Join (cost=448,290.97..479,526.33 rows=104,632 width=68) (actual time=2,149.847..2,152.100 rows=527 loops=1)

  • Merge Cond: ((w.month_request_data_id = d.id) AND ((date_part('month'::text, w.target_date)) = ((d.month)::double precision)))
3. 901.837 2,086.959 ↑ 4.0 600,426 1

Sort (cost=416,590.13..422,525.79 rows=2,374,264 width=20) (actual time=2,027.434..2,086.959 rows=600,426 loops=1)

  • Sort Key: w.month_request_data_id, (date_part('month'::text, w.target_date))
  • Sort Method: external merge Disk: 87,312kB
4. 1,185.122 1,185.122 ↓ 1.0 2,446,869 1

Seq Scan on waybill w (cost=0.00..116,474.86 rows=2,374,264 width=20) (actual time=47.138..1,185.122 rows=2,446,869 loops=1)

  • Filter: ((accepted IS TRUE) AND (deleted IS NULL))
  • Rows Removed by Filter: 376,429
5. 0.054 20.602 ↑ 204.0 513 1

Sort (cost=31,700.84..31,962.42 rows=104,632 width=64) (actual time=20.566..20.602 rows=513 loops=1)

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

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

7. 0.956 20.543 ↑ 5,812.9 18 1

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

  • Group Key: mrd.id, mr.month
8. 0.096 19.587 ↑ 199.3 525 1

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

9. 0.305 19.231 ↑ 364.6 20 1

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

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

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

  • Hash Cond: (mrd.month_request_id = mr.id)
11. 8.185 8.185 ↓ 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.028..8.185 rows=60,080 loops=1)

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

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

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

Seq Scan on month_request mr (cost=0.00..2.47 rows=25 width=8) (actual time=0.024..0.027 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.004 0.091 ↑ 57.0 4 1

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

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

Seq Scan on agreement a (cost=0.00..17.79 rows=228 width=4) (actual time=0.084..0.087 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.272 ms
Execution time : 2,173.397 ms