explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JPoy : Optimization for: Optimization for: plan #YZFI; plan #XFmI

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 74.316 485.502 ↓ 1.1 25,880 1

Sort (cost=61,951.44..62,012.44 rows=24,398 width=140) (actual time=476.530..485.502 rows=25,880 loops=1)

  • Sort Key: d.administracion
  • Sort Method: external sort Disk: 4152kB
2. 27.743 411.186 ↓ 1.1 25,880 1

Hash Left Join (cost=3,989.17..60,173.50 rows=24,398 width=140) (actual time=163.053..411.186 rows=25,880 loops=1)

  • Hash Cond: (d.id_medico = me.id)
3. 19.195 377.452 ↓ 1.1 25,880 1

Hash Left Join (cost=3,661.12..59,781.38 rows=24,398 width=127) (actual time=157.004..377.452 rows=25,880 loops=1)

  • Hash Cond: (d.id_seccion = a.id)
4. 20.927 349.970 ↓ 1.1 25,880 1

Hash Left Join (cost=3,236.07..59,292.25 rows=24,398 width=109) (actual time=148.610..349.970 rows=25,880 loops=1)

  • Hash Cond: (d.id_seccion = se.id)
5. 23.759 321.750 ↓ 1.1 25,880 1

Hash Left Join (cost=2,835.71..58,827.82 rows=24,398 width=105) (actual time=141.251..321.750 rows=25,880 loops=1)

  • Hash Cond: (d.id_servicio = s.id)
6. 242.995 257.373 ↓ 1.1 25,880 1

Bitmap Heap Scan on dispensaciones_cache d (cost=915.51..56,843.58 rows=24,398 width=105) (actual time=100.548..257.373 rows=25,880 loops=1)

  • Recheck Cond: (id_medicamento = 26179)
  • Filter: ((administraciond_normalizada >= 20180101) AND (administraciond_normalizada <= 20181231) AND (id_hospital = 290))
  • Rows Removed by Filter: 25142
  • Heap Blocks: exact=33358
7. 14.378 14.378 ↓ 1.0 51,022 1

Bitmap Index Scan on dispensacion_medicamento (cost=0.00..909.41 rows=49,198 width=0) (actual time=14.378..14.378 rows=51,022 loops=1)

  • Index Cond: (id_medicamento = 26179)
8. 20.472 40.618 ↑ 1.0 55,342 1

Hash (cost=1,228.42..1,228.42 rows=55,342 width=8) (actual time=40.618..40.618 rows=55,342 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 2674kB
9. 20.146 20.146 ↑ 1.0 55,342 1

Seq Scan on servicios s (cost=0.00..1,228.42 rows=55,342 width=8) (actual time=0.012..20.146 rows=55,342 loops=1)

10. 3.272 7.293 ↑ 1.0 12,194 1

Hash (cost=247.94..247.94 rows=12,194 width=8) (actual time=7.293..7.293 rows=12,194 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 605kB
11. 4.021 4.021 ↑ 1.0 12,194 1

Seq Scan on secciones se (cost=0.00..247.94 rows=12,194 width=8) (actual time=0.011..4.021 rows=12,194 loops=1)

12. 3.865 8.287 ↑ 1.0 9,380 1

Hash (cost=307.80..307.80 rows=9,380 width=26) (actual time=8.287..8.287 rows=9,380 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 680kB
13. 4.422 4.422 ↑ 1.0 9,380 1

Seq Scan on areas a (cost=0.00..307.80 rows=9,380 width=26) (actual time=0.015..4.422 rows=9,380 loops=1)

14. 2.865 5.991 ↑ 1.0 9,380 1

Hash (cost=210.80..210.80 rows=9,380 width=21) (actual time=5.991..5.991 rows=9,380 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 635kB
15. 3.126 3.126 ↑ 1.0 9,380 1

Seq Scan on medicos me (cost=0.00..210.80 rows=9,380 width=21) (actual time=0.008..3.126 rows=9,380 loops=1)

Planning time : 1.170 ms
Execution time : 488.863 ms