explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 68.314 1,329.329 ↓ 138.6 57,086 1

Nested Loop (cost=9.16..551.89 rows=412 width=194) (actual time=0.629..1,329.329 rows=57,086 loops=1)

2. 22.818 575.983 ↓ 137.9 57,086 1

Nested Loop (cost=8.74..307.62 rows=414 width=4) (actual time=0.612..575.983 rows=57,086 loops=1)

3. 3.161 7.249 ↓ 129.3 388 1

Hash Join (cost=8.31..140.19 rows=3 width=4) (actual time=0.582..7.249 rows=388 loops=1)

  • Hash Cond: ((pa.cod_atc)::text = (m.codigo)::text)
4. 4.028 4.028 ↑ 1.0 6,087 1

Seq Scan on prescripciones_atc pa (cost=0.00..115.87 rows=6,087 width=11) (actual time=0.016..4.028 rows=6,087 loops=1)

5. 0.002 0.060 ↑ 1.0 1 1

Hash (cost=8.30..8.30 rows=1 width=7) (actual time=0.060..0.060 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
6. 0.058 0.058 ↑ 1.0 1 1

Index Scan using medicamentos_id on medicamentos m (cost=0.28..8.30 rows=1 width=7) (actual time=0.057..0.058 rows=1 loops=1)

  • Index Cond: (id = 24117)
7. 545.916 545.916 ↑ 1.0 147 388

Index Scan using unidosis_id_medicamento on unidosis_dispensacion_hospital u (cost=0.43..54.32 rows=149 width=8) (actual time=0.023..1.407 rows=147 loops=388)

  • Index Cond: (id_prescripcion = pa.id_prescripcion)
  • Filter: ((administracion >= '2018-01-01 00:00:00'::timestamp without time zone) AND (administracion <= '2018-12-31 23:59:59'::timestamp without time zone))
  • Rows Removed by Filter: 142
8. 685.032 685.032 ↑ 1.0 1 57,086

Index Scan using id_nf on episodios_cache_nf e (cost=0.42..0.58 rows=1 width=194) (actual time=0.009..0.012 rows=1 loops=57,086)

  • Index Cond: (id = u.id_episodio)
  • Filter: ((id_hospital = 290) AND (id_norma = 1))
  • Rows Removed by Filter: 4
Planning time : 2.409 ms
Execution time : 1,336.882 ms