explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YAn1

Settings
# exclusive inclusive rows x rows loops node
1. 0.029 558.077 ↑ 8.0 4 1

Aggregate (cost=97,778.43..97,780.67 rows=32 width=462) (actual time=558.06..558.077 rows=4 loops=1)

2. 0.058 558.048 ↑ 4.0 8 1

Sort (cost=97,778.43..97,778.51 rows=32 width=390) (actual time=558.047..558.048 rows=8 loops=1)

  • Sort Key: a.grupo, a.id_grupo
  • Sort Method: quicksort Memory: 26kB
3. 0.005 557.990 ↑ 4.0 8 1

Subquery Scan on a (cost=51,088.09..97,777.63 rows=32 width=390) (actual time=483.314..557.99 rows=8 loops=1)

4. 0.003 557.985 ↑ 4.0 8 1

Append (cost=51,088.09..97,777.31 rows=32 width=390) (actual time=483.313..557.985 rows=8 loops=1)

5. 0.003 483.343 ↑ 4.0 4 1

Subquery Scan on *SELECT* 1 (cost=51,088.09..51,090.05 rows=16 width=181) (actual time=483.312..483.343 rows=4 loops=1)

6. 0.061 483.340 ↑ 4.0 4 1

Aggregate (cost=51,088.09..51,089.85 rows=16 width=181) (actual time=483.311..483.34 rows=4 loops=1)

7. 0.000 483.279 ↑ 2.7 12 1

Sort (cost=51,088.09..51,088.17 rows=32 width=241) (actual time=483.277..483.279 rows=12 loops=1)

  • Sort Key: e.sexo, e.id_sexo
  • Sort Method: quicksort Memory: 31kB
8. 13.870 483.367 ↑ 2.7 12 1

Gather (cost=51,083.89..51,087.29 rows=32 width=241) (actual time=476.615..483.367 rows=12 loops=1)

9. 143.214 469.497 ↑ 4.0 4 3

Aggregate (cost=50,083.89..50,084.09 rows=16 width=241) (actual time=469.491..469.497 rows=4 loops=3)

10. 326.283 326.283 ↑ 1.2 18,345 3

Seq Scan on episodios_cache e (cost=0..49,066.17 rows=22,616 width=51) (actual time=0.215..326.283 rows=18,345 loops=3)

  • Filter: ((altad_normalizada >= 20180101) AND (altad_normalizada <= 20181231) AND (id_hospital = 290) AND (id_norma = 1))
11. 0.007 74.639 ↑ 4.0 4 1

Subquery Scan on *SELECT* 2 (cost=46,686.58..46,687.26 rows=16 width=181) (actual time=74.635..74.639 rows=4 loops=1)

12. 0.018 74.632 ↑ 4.0 4 1

Sort (cost=46,686.58..46,686.62 rows=16 width=129) (actual time=74.632..74.632 rows=4 loops=1)

  • Sort Key: e_1.sexo
  • Sort Method: quicksort Memory: 25kB
13. 25.411 74.614 ↑ 4.0 4 1

Aggregate (cost=46,686.1..46,686.26 rows=16 width=129) (actual time=74.611..74.614 rows=4 loops=1)

14. 49.203 49.203 ↓ 1.0 32,905 1

Index Scan using hospital_norma on episodios_cache e_1 (cost=0.42..46,448.17 rows=31,725 width=17) (actual time=0.061..49.203 rows=32,905 loops=1)

  • Index Cond: ((id_hospital = 290) AND (altad_normalizada >= 20170101) AND (altad_normalizada <= 20171231) AND (id_norma = 1))