explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 0br8 : Optimization for: Optimization for: plan #nh5b; plan #6bdP

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.406 1,965.441 ↑ 768.0 357 1

Group (cost=57,263.69..98,842.51 rows=274,176 width=42) (actual time=1,697.291..1,965.441 rows=357 loops=1)

2. 81.648 1,965.035 ↑ 295.6 1,071 1

Gather Merge (cost=57,263.69..95,782.77 rows=316,574 width=42) (actual time=1,697.289..1,965.035 rows=1,071 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 64.481 1,883.387 ↑ 443.4 357 3 / 3

Group (cost=56,263.66..58,242.25 rows=158,287 width=42) (actual time=1,683.558..1,883.387 rows=357 loops=3)

4. 621.952 1,818.906 ↑ 1.2 130,160 3 / 3

Sort (cost=56,263.66..56,659.38 rows=158,287 width=42) (actual time=1,683.555..1,818.906 rows=130,160 loops=3)

  • Sort Key: aec.id_grupo, (concat(atc4.codigo, '-', atc4.descripcion)), atc4.codigo
  • Sort Method: external merge Disk: 9512kB
5. 628.259 1,196.954 ↑ 1.2 130,160 3 / 3

Hash Join (cost=13,310.19..37,721.85 rows=158,287 width=42) (actual time=172.23..1,196.954 rows=130,160 loops=3)

6. 98.279 568.043 ↑ 1.2 130,160 3 / 3

Nested Loop (cost=13,284.91..36,883.06 rows=158,287 width=4) (actual time=171.473..568.043 rows=130,160 loops=3)

7. 10.297 260.631 ↑ 1.2 3,669 3 / 3

Hash Join (cost=13,284.48..24,959.73 rows=4,402 width=8) (actual time=171.409..260.631 rows=3,669 loops=3)

8. 93.366 100.596 ↑ 1.2 3,669 3 / 3

Bitmap Heap Scan on episodios_cache_nf e (cost=679.29..12,149.74 rows=4,435 width=8) (actual time=21.543..100.596 rows=3,669 loops=3)

  • Filter: ((altad_normalizada >= 20180101) AND (altad_normalizada <= 20181231) AND (id_hospital = 290))
  • Heap Blocks: exact=4174
9. 7.230 7.230 ↓ 1.4 44,424 1 / 3

Bitmap Index Scan on norma_nf (cost=0..676.62 rows=31,494 width=0) (actual time=21.689..21.689 rows=44,424 loops=1)

  • Index Cond: (id_norma = 1)
10. 24.435 149.738 ↑ 1.0 31,844 3 / 3

Hash (cost=12,206.81..12,206.81 rows=31,871 width=4) (actual time=149.738..149.738 rows=31,844 loops=3)

11. 113.708 125.303 ↑ 1.0 31,844 3 / 3

Bitmap Heap Scan on episodios_cache_ne ne (cost=691.42..12,206.81 rows=31,871 width=4) (actual time=17.536..125.303 rows=31,844 loops=3)

  • Heap Blocks: exact=10983
12. 11.595 11.595 ↓ 1.4 43,863 3 / 3

Bitmap Index Scan on norma_ne (cost=0..683.45 rows=31,871 width=0) (actual time=11.595..11.595 rows=43,863 loops=3)

  • Index Cond: (id_norma = 1)
13. 209.133 209.133 ↑ 1.2 35 11,007 / 3

Index Only Scan using atc_4_episodio_cache_pkey on atc_4_episodio_cache aec (cost=0.43..2.18 rows=42 width=8) (actual time=0.027..0.057 rows=35 loops=11,007)

  • Index Cond: (id_episodio = ne.id)
  • Heap Fetches: 159018
14. 0.293 0.652 ↑ 1.0 768 3 / 3

Hash (cost=15.68..15.68 rows=768 width=43) (actual time=0.652..0.652 rows=768 loops=3)

15. 0.359 0.359 ↑ 1.0 768 3 / 3

Seq Scan on atc_nivel_4 atc4 (cost=0..15.68 rows=768 width=43) (actual time=0.034..0.359 rows=768 loops=3)

Planning time : 3.796 ms
Execution time : 1,971.095 ms