explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kqJd

Settings
# exclusive inclusive rows x rows loops node
1. 152.419 1,315.888 ↓ 138.6 57,086 1

Sort (cost=784.42..785.45 rows=412 width=117) (actual time=1,295.431..1,315.888 rows=57,086 loops=1)

  • Sort Key: d.administracion
  • Sort Method: external merge Disk: 6944kB
2. 80.780 1,163.469 ↓ 138.6 57,086 1

Nested Loop Left Join (cost=10.16..766.53 rows=412 width=117) (actual time=0.619..1,163.469 rows=57,086 loops=1)

3. 80.769 911.431 ↓ 138.6 57,086 1

Nested Loop Left Join (cost=9.88..641.63 rows=412 width=104) (actual time=0.610..911.431 rows=57,086 loops=1)

4. 83.184 716.490 ↓ 138.6 57,086 1

Nested Loop Left Join (cost=9.59..516.56 rows=412 width=86) (actual time=0.600..716.490 rows=57,086 loops=1)

5. 47.978 519.134 ↓ 138.6 57,086 1

Nested Loop Left Join (cost=9.31..391.63 rows=412 width=82) (actual time=0.589..519.134 rows=57,086 loops=1)

6. 35.767 299.898 ↓ 138.6 57,086 1

Nested Loop (cost=9.02..263.42 rows=412 width=82) (actual time=0.574..299.898 rows=57,086 loops=1)

7. 1.173 8.051 ↓ 129.3 388 1

Nested Loop (cost=8.59..141.78 rows=3 width=38) (actual time=0.542..8.051 rows=388 loops=1)

8. 2.889 4.550 ↓ 129.3 388 1

Hash Join (cost=8.31..140.19 rows=3 width=34) (actual time=0.505..4.550 rows=388 loops=1)

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

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

10. 0.005 0.133 ↑ 1.0 1 1

Hash (cost=8.30..8.30 rows=1 width=37) (actual time=0.133..0.133 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
11. 0.128 0.128 ↑ 1.0 1 1

Index Scan using medicamentos_id on medicamentos m (cost=0.28..8.30 rows=1 width=37) (actual time=0.127..0.128 rows=1 loops=1)

  • Index Cond: (id = 24117)
12. 2.328 2.328 ↑ 1.0 1 388

Index Only Scan using prescripciones_pkey on prescripciones p (cost=0.28..0.53 rows=1 width=4) (actual time=0.006..0.006 rows=1 loops=388)

  • Index Cond: (id = pa.id_prescripcion)
  • Heap Fetches: 388
13. 256.080 256.080 ↑ 1.0 147 388

Index Scan using unidosis_cache on unidosis_dispensacion_hospital d (cost=0.43..39.07 rows=148 width=56) (actual time=0.026..0.660 rows=147 loops=388)

  • Index Cond: ((id_hospital = 290) AND (id_medicamento = p.id) AND (administracion >= '2018-01-01 00:00:00'::timestamp without time zone) AND (administracion <= '2018-12-31 23:59:59'::timestamp without time zone))
14. 171.258 171.258 ↑ 1.0 1 57,086

Index Scan using servicios_pkey on servicios s (cost=0.29..0.31 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=57,086)

  • Index Cond: (id = d.id_servicio)
15. 114.172 114.172 ↑ 1.0 1 57,086

Index Scan using secciones_pkey on secciones se (cost=0.29..0.30 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=57,086)

  • Index Cond: (id = d.id_seccion)
16. 114.172 114.172 ↑ 1.0 1 57,086

Index Scan using areas_pkey on areas a (cost=0.29..0.30 rows=1 width=26) (actual time=0.002..0.002 rows=1 loops=57,086)

  • Index Cond: (id = d.id_seccion)
17. 171.258 171.258 ↑ 1.0 1 57,086

Index Scan using medicos_pkey on medicos me (cost=0.29..0.30 rows=1 width=21) (actual time=0.003..0.003 rows=1 loops=57,086)

  • Index Cond: (id = d.id_medico)
Planning time : 14.156 ms
Execution time : 1,322.607 ms