explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 6bdP : Optimization for: plan #nh5b

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.407 1,663.624 ↑ 768.0 357 1

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

  • Group Key: aec.id_grupo, (concat(atc4.codigo, '-', atc4.descripcion)), atc4.codigo
2. 55.968 1,663.217 ↑ 295.6 1,071 1

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

  • Workers Planned: 2
  • Workers Launched: 2
3. 59.198 1,607.249 ↑ 443.4 357 3 / 3

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

  • Group Key: aec.id_grupo, (concat(atc4.codigo, '-', atc4.descripcion)), atc4.codigo
4. 534.946 1,548.051 ↑ 1.2 130,160 3 / 3

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

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

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

6. 87.127 571.367 ↑ 1.2 130,160 3 / 3

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

7. 6.708 234.748 ↑ 1.2 3,669 3 / 3

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

8. 82.981 87.806 ↑ 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=15.632..87.806 rows=3,669 loops=3)

  • Filter: ((altad_normalizada >= 20,180,101) AND (altad_normalizada <= 20,181,231) AND (id_hospital = 290))
  • Heap Blocks: exact=3,847
9. 4.825 4.825 ↓ 1.4 44,424 1 / 3

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

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

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

11. 96.072 109.070 ↑ 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=23.444..109.07 rows=31,844 loops=3)

  • Heap Blocks: exact=10,983
12. 12.998 12.998 ↓ 1.4 43,863 3 / 3

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

  • Index Cond: (id_norma = 1)
13. 249.492 249.492 ↑ 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.037..0.068 rows=35 loops=11,007)

  • Index Cond: (id_episodio = ne.id)
  • Heap Fetches: 146,653
14. 0.245 0.528 ↑ 1.0 768 3 / 3

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

15. 0.283 0.283 ↑ 1.0 768 3 / 3

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

Planning time : 3.618 ms
Execution time : 1,667.844 ms