explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 0gc : Optimization for: plan #XvSw

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 16.632 339.550 ↓ 2.6 530 1

GroupAggregate (cost=32,188.36..32,391.56 rows=200 width=132) (actual time=321.541..339.55 rows=530 loops=1)

  • Group Key: a.atc, a.metrica_codigo
2. 23.343 322.918 ↓ 1.3 11,130 1

Sort (cost=32,188.36..32,210.44 rows=8,831 width=54) (actual time=321.475..322.918 rows=11,130 loops=1)

  • Sort Key: a.atc, a.metrica_codigo
  • Sort Method: quicksort Memory: 1949kB
3. 35.954 299.575 ↓ 1.3 11,130 1

Hash Join (cost=30,290.27..31,609.56 rows=8,831 width=54) (actual time=259.362..299.575 rows=11,130 loops=1)

4. 0.714 79.192 ↓ 1.3 2,226 1

Subquery Scan on a (cost=15,885.82..16,091.78 rows=1,766 width=36) (actual time=74.821..79.192 rows=2,226 loops=1)

5. 1.342 78.478 ↓ 1.3 2,226 1

Group (cost=15,885.82..16,074.12 rows=1,766 width=36) (actual time=74.82..78.478 rows=2,226 loops=1)

  • Group Key: e_1.id, d.atc, d.atc_descripcion
6. 13.864 77.136 ↓ 1.5 2,226 1

Gather Merge (cost=15,885.82..16,063.08 rows=1,472 width=36) (actual time=74.817..77.136 rows=2,226 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
7. 0.522 63.272 ↓ 1.0 742 3 / 3

Group (cost=14,885.79..14,893.15 rows=736 width=36) (actual time=62.583..63.272 rows=742 loops=3)

  • Group Key: e_1.id, d.atc, d.atc_descripcion
8. 2.458 62.750 ↓ 1.3 966 3 / 3

Sort (cost=14,885.79..14,887.63 rows=736 width=36) (actual time=62.572..62.75 rows=966 loops=3)

  • Sort Key: e_1.id, d.atc, d.atc_descripcion
  • Sort Method: quicksort Memory: 180kB
9. 0.443 60.292 ↓ 1.3 966 3 / 3

Nested Loop (cost=4.95..14,850.75 rows=736 width=36) (actual time=7.822..60.292 rows=966 loops=3)

10. 54.041 54.041 ↓ 1.2 16 3 / 3

Seq Scan on episodios_cache_nf e_1 (cost=0..11,381.69 rows=13 width=4) (actual time=7.716..54.041 rows=16 loops=3)

  • Filter: ((altad_normalizada >= 20180101) AND (altad_normalizada <= 20181231) AND (id_hospital = 290) AND (id_norma = 1) AND ((grd)::text = '002'::text))
11. 5.472 5.808 ↑ 1.1 60 48 / 3

Bitmap Heap Scan on dispensaciones_cache d (cost=4.95..266.17 rows=68 width=36) (actual time=0.036..0.363 rows=60 loops=48)

  • Heap Blocks: exact=1429
12. 0.336 0.336 ↑ 1.1 60 48 / 3

Bitmap Index Scan on dispensacion_episodio (cost=0..4.94 rows=68 width=0) (actual time=0.021..0.021 rows=60 loops=48)

  • Index Cond: (id_episodio = e_1.id)
13. 69.307 184.429 ↑ 1.0 159,220 1

Hash (cost=11,481.2..11,481.2 rows=159,220 width=18) (actual time=184.429..184.429 rows=159,220 loops=1)

14. 115.122 115.122 ↑ 1.0 159,220 1

Seq Scan on episodios_cache_nf e (cost=0..11,481.2 rows=159,220 width=18) (actual time=0.018..115.122 rows=159,220 loops=1)

Planning time : 1.65 ms
Execution time : 340.074 ms