explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bcc9

Settings
# exclusive inclusive rows x rows loops node
1. 0.486 19,451.573 ↓ 13.0 13 1

Nested Loop (cost=10.31..108.04 rows=1 width=4) (actual time=919.873..19,451.573 rows=13 loops=1)

2. 0.449 19,433.946 ↓ 61.0 61 1

Nested Loop Left Join (cost=10.31..108.01 rows=1 width=33) (actual time=917.245..19,433.946 rows=61 loops=1)

3. 0.381 19,433.375 ↓ 61.0 61 1

Nested Loop Left Join (cost=10.02..107.71 rows=1 width=29) (actual time=917.211..19,433.375 rows=61 loops=1)

4. 0.513 19,432.811 ↓ 61.0 61 1

Nested Loop (cost=9.60..99.27 rows=1 width=29) (actual time=917.188..19,432.811 rows=61 loops=1)

5. 0.631 19,431.810 ↓ 61.0 61 1

Nested Loop (cost=9.31..98.96 rows=1 width=29) (actual time=917.173..19,431.810 rows=61 loops=1)

6. 0.494 19,430.386 ↓ 61.0 61 1

Nested Loop Left Join (cost=9.02..90.78 rows=1 width=29) (actual time=917.147..19,430.386 rows=61 loops=1)

7. 0.496 75.995 ↓ 61.0 61 1

Nested Loop (cost=9.02..90.76 rows=1 width=29) (actual time=3.983..75.995 rows=61 loops=1)

8. 1.337 74.950 ↓ 61.0 61 1

Hash Join (cost=8.74..82.44 rows=1 width=29) (actual time=3.967..74.950 rows=61 loops=1)

  • Hash Cond: (historico.matrizcurricular = matricula.gradecurricularatual)
  • Join Filter: ((SubPlan 1) = historico.codigo)
  • Rows Removed by Join Filter: 4
9. 1.748 1.748 ↓ 3.6 115 1

Index Scan using ch_historico_matricula on historico (cost=0.42..74.04 rows=32 width=37) (actual time=0.272..1.748 rows=115 loops=1)

  • Index Cond: ((matricula)::text = '1813180000058'::text)
10. 0.013 0.170 ↑ 1.0 1 1

Hash (cost=8.31..8.31 rows=1 width=24) (actual time=0.169..0.170 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
11. 0.157 0.157 ↑ 1.0 1 1

Index Scan using matricula_pkey on matricula (cost=0.29..8.31 rows=1 width=24) (actual time=0.153..0.157 rows=1 loops=1)

  • Index Cond: ((matricula)::text = '1813180000058'::text)
12.          

SubPlan (for Hash Join)

13. 0.975 71.695 ↑ 1.0 1 65

Limit (cost=32.84..32.84 rows=1 width=9) (actual time=1.091..1.103 rows=1 loops=65)

14. 1.365 70.720 ↑ 1.0 1 65

Sort (cost=32.84..32.84 rows=1 width=9) (actual time=1.087..1.088 rows=1 loops=65)

  • Sort Key: his.anohistorico DESC, his.semestrehistorico DESC, his.codigo DESC
  • Sort Method: quicksort Memory: 25kB
15. 1.820 69.355 ↑ 1.0 1 65

Bitmap Heap Scan on historico his (cost=28.81..32.83 rows=1 width=9) (actual time=1.061..1.067 rows=1 loops=65)

  • Recheck Cond: (((matricula.matricula)::text = (matricula)::text) AND (disciplina = historico.disciplina))
  • Filter: (matrizcurricular = matricula.gradecurricularatual)
  • Rows Removed by Filter: 1
  • Heap Blocks: exact=110
16. 1.170 67.535 ↓ 0.0 0 65

BitmapAnd (cost=28.81..28.81 rows=1 width=0) (actual time=1.038..1.039 rows=0 loops=65)

17. 3.510 3.510 ↓ 3.5 115 65

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..4.67 rows=33 width=0) (actual time=0.053..0.054 rows=115 loops=65)

  • Index Cond: ((matricula.matricula)::text = (matricula)::text)
18. 62.855 62.855 ↓ 3.9 3,867 65

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..23.89 rows=995 width=0) (actual time=0.966..0.967 rows=3,867 loops=65)

  • Index Cond: (disciplina = historico.disciplina)
19. 0.549 0.549 ↑ 1.0 1 61

Index Only Scan using curso_pkey on curso (cost=0.28..8.29 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=61)

  • Index Cond: (codigo = matricula.curso)
  • Heap Fetches: 61
20. 19,353.897 19,353.897 ↓ 0.0 0 61

Function Scan on periodoauladisciplinaaluno horario (cost=0.00..0.01 rows=1 width=4) (actual time=317.276..317.277 rows=0 loops=61)

  • Filter: (professor_codigo IS NOT NULL)
21. 0.793 0.793 ↑ 1.0 1 61

Index Scan using matriculaperiodo_pkey on matriculaperiodo (cost=0.29..8.19 rows=1 width=8) (actual time=0.013..0.013 rows=1 loops=61)

  • Index Cond: (codigo = historico.matriculaperiodo)
22. 0.488 0.488 ↑ 1.0 1 61

Index Scan using turma_pkey on turma turmabase (cost=0.28..0.31 rows=1 width=8) (actual time=0.008..0.008 rows=1 loops=61)

  • Index Cond: (codigo = matriculaperiodo.turma)
23. 0.183 0.183 ↓ 0.0 0 61

Index Scan using matriculaperiodoturmadisciplina_pkey on matriculaperiodoturmadisciplina (cost=0.42..8.44 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=61)

  • Index Cond: (codigo = historico.matriculaperiodoturmadisciplina)
24. 0.122 0.122 ↓ 0.0 0 61

Index Scan using turma_pkey on turma (cost=0.28..0.30 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=61)

  • Index Cond: (codigo = matriculaperiodoturmadisciplina.turma)
25. 17.141 17.141 ↓ 0.0 0 61

Function Scan on consultarplanoensino planoensino (cost=0.00..0.01 rows=1 width=0) (actual time=0.281..0.281 rows=0 loops=61)

  • Filter: (codigo IS NOT NULL)
Planning time : 14.461 ms
Execution time : 19,452.198 ms