explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.252 1,104.585 ↑ 2.2 357 1

Group (cost=39,362.06..39,371.66 rows=768 width=32) (actual time=1,104.23..1,104.585 rows=357 loops=1)

  • Group Key: (concat(atc4.codigo, '-', atc4.descripcion))
2. 0.000 1,104.333 ↑ 1.4 1,071 1

Sort (cost=39,362.06..39,365.9 rows=1,536 width=32) (actual time=1,104.228..1,104.333 rows=1,071 loops=1)

  • Sort Key: (concat(atc4.codigo, '-', atc4.descripcion))
  • Sort Method: quicksort Memory: 148kB
3. 23.078 1,109.811 ↑ 1.4 1,071 1

Gather (cost=39,117.57..39,280.77 rows=1,536 width=32) (actual time=1,098.337..1,109.811 rows=1,071 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 131.062 1,086.733 ↑ 2.2 357 3 / 3

HashAggregate (cost=38,117.57..38,127.17 rows=768 width=32) (actual time=1,086.622..1,086.733 rows=357 loops=3)

  • Group Key: concat(atc4.codigo, '-', atc4.descripcion)
5. 449.723 955.671 ↑ 1.2 130,160 3 / 3

Hash Join (cost=13,310.19..37,721.85 rows=158,287 width=32) (actual time=170.146..955.671 rows=130,160 loops=3)

6. 72.482 505.022 ↑ 1.2 130,160 3 / 3

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

7. 13.555 241.752 ↑ 1.2 3,669 3 / 3

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

8. 74.495 79.522 ↑ 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=19.938..79.522 rows=3,669 loops=3)

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

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

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

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

11. 121.335 128.621 ↑ 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=14.503..128.621 rows=31,844 loops=3)

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

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

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

  • Index Cond: (id_episodio = ne.id)
  • Heap Fetches: 121407
14. 0.475 0.926 ↑ 1.0 768 3 / 3

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

15. 0.451 0.451 ↑ 1.0 768 3 / 3

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

Planning time : 3.908 ms
Execution time : 1,112.04 ms