explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qJ5E : Optimization for: Optimization for: Optimization for: Optimization for: plan #cjH6; plan #RIdw; plan #VE6w; plan #VneM

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 72.405 1,002.696 ↑ 2.4 22,514 1

Unique (cost=77,178.80..80,287.48 rows=54,064 width=194) (actual time=812.091..1,002.696 rows=22,514 loops=1)

2. 357.616 930.291 ↓ 1.1 57,086 1

Sort (cost=77,178.80..77,313.96 rows=54,064 width=194) (actual time=812.090..930.291 rows=57,086 loops=1)

  • Sort Key: e.alta, e.id, e.historia, e.episodio, e.edad, e.sexo, e.grd, e.fullgrd, e.gravedad, e.servicio, e.fullservicio, e.circunstancia_alta, e.complejidad, e.ingreso, e.reingreso, e.cronico, e.exitus, e.dias_estancia_totales, e.dias_estancia_uci, e.id_planta, e.coste_medio_esperado_alta_depurado, e.coste_farmacia_episodio
  • Sort Method: external merge Disk: 12008kB
3. 99.643 572.675 ↓ 1.1 57,086 1

Hash Join (cost=15,580.74..67,752.23 rows=54,064 width=194) (actual time=280.761..572.675 rows=57,086 loops=1)

  • Hash Cond: (d.id_episodio = e.id)
4. 299.468 317.608 ↓ 1.1 57,086 1

Bitmap Heap Scan on dispensaciones_cache d (cost=2,040.37..50,409.23 rows=54,317 width=4) (actual time=125.222..317.608 rows=57,086 loops=1)

  • Recheck Cond: (id_medicamento = 24117)
  • Filter: ((administraciond_normalizada >= 20180101) AND (administraciond_normalizada <= 20181231))
  • Rows Removed by Filter: 54906
  • Heap Blocks: exact=42662
5. 18.140 18.140 ↓ 1.0 111,992 1

Bitmap Index Scan on dispensacion_medicamento (cost=0.00..2,026.79 rows=109,649 width=0) (actual time=18.140..18.140 rows=111,992 loops=1)

  • Index Cond: (id_medicamento = 24117)
6. 30.062 155.424 ↓ 1.0 31,844 1

Hash (cost=12,277.30..12,277.30 rows=31,685 width=194) (actual time=155.424..155.424 rows=31,844 loops=1)

  • Buckets: 32768 Batches: 2 Memory Usage: 3957kB
7. 125.362 125.362 ↓ 1.0 31,844 1

Seq Scan on episodios_cache_nf e (cost=0.00..12,277.30 rows=31,685 width=194) (actual time=0.017..125.362 rows=31,844 loops=1)

  • Filter: ((id_hospital = 290) AND (id_norma = 1))
  • Rows Removed by Filter: 127376
Planning time : 0.935 ms
Execution time : 1,008.470 ms