explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YZFI

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 71.436 652.512 ↓ 62.5 25,880 1

Sort (cost=803.12..804.16 rows=414 width=117) (actual time=643.600..652.512 rows=25,880 loops=1)

  • Sort Key: d.administracion
  • Sort Method: external merge Disk: 3232kB
2. 19.190 581.076 ↓ 62.5 25,880 1

Nested Loop Left Join (cost=10.16..785.13 rows=414 width=117) (actual time=2.079..581.076 rows=25,880 loops=1)

3. 39.536 458.366 ↓ 62.5 25,880 1

Nested Loop Left Join (cost=9.88..659.63 rows=414 width=104) (actual time=2.029..458.366 rows=25,880 loops=1)

4. 38.550 367.070 ↓ 62.5 25,880 1

Nested Loop Left Join (cost=9.59..533.95 rows=414 width=86) (actual time=1.917..367.070 rows=25,880 loops=1)

5. 27.351 276.760 ↓ 62.5 25,880 1

Nested Loop Left Join (cost=9.31..408.42 rows=414 width=82) (actual time=1.181..276.760 rows=25,880 loops=1)

6. 16.995 171.769 ↓ 62.5 25,880 1

Nested Loop (cost=9.02..279.60 rows=414 width=82) (actual time=0.965..171.769 rows=25,880 loops=1)

7. 0.678 5.878 ↓ 58.7 176 1

Nested Loop (cost=8.59..141.78 rows=3 width=38) (actual time=0.798..5.878 rows=176 loops=1)

8. 2.254 3.792 ↓ 58.7 176 1

Hash Join (cost=8.31..140.19 rows=3 width=34) (actual time=0.347..3.792 rows=176 loops=1)

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

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

10. 0.006 0.061 ↑ 1.0 1 1

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

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

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

  • Index Cond: (id = 26179)
12. 1.408 1.408 ↑ 1.0 1 176

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

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

Index Scan using unidosis_cache on unidosis_dispensacion_hospital d (cost=0.43..44.45 rows=149 width=56) (actual time=0.022..0.846 rows=147 loops=176)

  • Index Cond: ((id_hospital = 290) AND (id_prescripcion = 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. 77.640 77.640 ↑ 1.0 1 25,880

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=25,880)

  • Index Cond: (id = d.id_servicio)
15. 51.760 51.760 ↑ 1.0 1 25,880

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=25,880)

  • Index Cond: (id = d.id_seccion)
16. 51.760 51.760 ↑ 1.0 1 25,880

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=25,880)

  • Index Cond: (id = d.id_seccion)
17. 103.520 103.520 ↑ 1.0 1 25,880

Index Scan using medicos_pkey on medicos me (cost=0.29..0.30 rows=1 width=21) (actual time=0.004..0.004 rows=1 loops=25,880)

  • Index Cond: (id = d.id_medico)
Planning time : 9.980 ms
Execution time : 655.936 ms