explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gubb

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 2,945.169 ↓ 0.0 0 1

Sort (cost=637,795.19..637,795.20 rows=1 width=596) (actual time=2,945.169..2,945.169 rows=0 loops=1)

  • Sort Key: matricula.data
  • Sort Method: quicksort Memory: 25kB
2. 0.000 2,945.163 ↓ 0.0 0 1

Nested Loop Left Join (cost=12,607.19..637,795.18 rows=1 width=596) (actual time=2,945.163..2,945.163 rows=0 loops=1)

3. 0.001 2,945.163 ↓ 0.0 0 1

Nested Loop (cost=12,606.92..637,794.88 rows=1 width=540) (actual time=2,945.163..2,945.163 rows=0 loops=1)

4. 15.215 2,945.162 ↓ 0.0 0 1

Nested Loop (cost=12,606.78..637,794.71 rows=1 width=525) (actual time=2,945.162..2,945.162 rows=0 loops=1)

  • Join Filter: (matriculaperiodo.unidadeensinocurso = uec.codigo)
5. 5.513 5.513 ↑ 1.0 31,111 1

Index Scan using ch_unidadeensinocurso_turno on unidadeensinocurso uec (cost=0.29..828.32 rows=31,111 width=12) (actual time=0.011..5.513 rows=31,111 loops=1)

6. 0.000 2,924.434 ↓ 0.0 0 31,111

Materialize (cost=12,606.49..636,499.73 rows=1 width=513) (actual time=0.094..0.094 rows=0 loops=31,111)

7. 0.000 2,936.546 ↓ 0.0 0 1

Nested Loop Left Join (cost=12,606.49..636,499.72 rows=1 width=513) (actual time=2,936.546..2,936.546 rows=0 loops=1)

8. 0.000 2,936.546 ↓ 0.0 0 1

Nested Loop Left Join (cost=12,606.21..636,499.41 rows=1 width=504) (actual time=2,936.546..2,936.546 rows=0 loops=1)

9. 0.001 2,936.546 ↓ 0.0 0 1

Nested Loop (cost=12,606.07..636,499.24 rows=1 width=479) (actual time=2,936.546..2,936.546 rows=0 loops=1)

10. 0.000 2,936.545 ↓ 0.0 0 1

Nested Loop Left Join (cost=12,605.93..636,499.07 rows=1 width=464) (actual time=2,936.545..2,936.545 rows=0 loops=1)

11. 0.000 2,936.545 ↓ 0.0 0 1

Nested Loop (cost=12,605.65..636,498.76 rows=1 width=454) (actual time=2,936.545..2,936.545 rows=0 loops=1)

12. 0.000 2,936.545 ↓ 0.0 0 1

Nested Loop (cost=12,605.37..636,498.45 rows=1 width=390) (actual time=2,936.545..2,936.545 rows=0 loops=1)

13. 0.001 2,936.545 ↓ 0.0 0 1

Nested Loop (cost=12,605.10..636,498.15 rows=1 width=330) (actual time=2,936.545..2,936.545 rows=0 loops=1)

14. 0.000 2,936.544 ↓ 0.0 0 1

Nested Loop (cost=12,604.82..636,497.84 rows=1 width=310) (actual time=2,936.544..2,936.544 rows=0 loops=1)

15. 0.000 2,936.544 ↓ 0.0 0 1

Nested Loop (cost=12,604.55..636,497.54 rows=1 width=259) (actual time=2,936.544..2,936.544 rows=0 loops=1)

16. 0.001 2,936.544 ↓ 0.0 0 1

Nested Loop (cost=12,604.41..636,497.37 rows=1 width=243) (actual time=2,936.544..2,936.544 rows=0 loops=1)

17. 585.830 2,936.543 ↓ 0.0 0 1

Merge Join (cost=12,603.98..636,496.78 rows=1 width=204) (actual time=2,936.543..2,936.543 rows=0 loops=1)

  • Merge Cond: ((matriculaperiodo.matricula)::text = (matricula.matricula)::text)
  • Join Filter: ((matriculaperiodo.codigo = (SubPlan 1)) AND ((SubPlan 2) = matriculaperiodo.codigo))
  • Rows Removed by Join Filter: 139199
18. 99.067 99.067 ↑ 1.0 139,199 1

Index Scan using ch_matriculaperiodo_matricula on matriculaperiodo (cost=0.42..5,330.57 rows=139,199 width=93) (actual time=0.006..99.067 rows=139,199 loops=1)

19. 620.090 720.457 ↓ 1.5 139,249 1

Sort (cost=12,603.56..12,831.20 rows=91,053 width=111) (actual time=711.895..720.457 rows=139,249 loops=1)

  • Sort Key: matricula.matricula
  • Sort Method: quicksort Memory: 25398kB
20. 100.367 100.367 ↓ 1.5 136,897 1

Index Scan using idx_matricula_unidadeensino on matricula (cost=0.52..5,103.34 rows=91,053 width=111) (actual time=0.014..100.367 rows=136,897 loops=1)

  • Index Cond: (unidadeensino = ANY ('{0,1001,1,2,3,4,5,6,7,8,9,10,1008,11,13,12,14,15,16,17,18,1007,1000,19,20,21,22,23,24,25,26,27,1006,28,29,30,31,32,1004,33,34,35,37,36,39,38,40,41,42,43,1005,44,1002,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69}'::integer[]))
21.          

SubPlan (forMerge Join)

22. 0.000 1,531.189 ↑ 1.0 1 139,199

Limit (cost=2.66..2.66 rows=1 width=9) (actual time=0.011..0.011 rows=1 loops=139,199)

23. 417.597 1,531.189 ↑ 1.0 1 139,199

Sort (cost=2.66..2.66 rows=1 width=9) (actual time=0.011..0.011 rows=1 loops=139,199)

  • Sort Key: ((((mp.ano)::text || '/'::text) || (mp.semestre)::text)), (CASE WHEN ((mp.situacaomatriculaperiodo)::text = ANY ('{AT,PR,FI,FO}'::text[])) THEN 1 ELSE 2 END), mp.codigo
  • Sort Method: quicksort Memory: 25kB
24. 1,113.592 1,113.592 ↑ 1.0 1 139,199

Index Scan using idx_matriculaperiodo_matricula_ano_semestre on matriculaperiodo mp (cost=0.42..2.65 rows=1 width=9) (actual time=0.008..0.008 rows=1 loops=139,199)

  • Index Cond: ((matricula)::text = (matricula.matricula)::text)
25. 0.000 0.000 ↓ 0.0 0 136,847

HashAggregate (cost=3.98..3.99 rows=1 width=4) (actual time=0.000..0.000 rows=0 loops=136,847)

  • Group Key: mp_1.codigo
26. 0.000 0.000 ↓ 0.0 0 136,847

Result (cost=0.42..3.98 rows=1 width=4) (actual time=0.000..0.000 rows=0 loops=136,847)

  • One-Time Filter: (((matricula.situacao)::text = 'AT'::text) AND (matricula.bloqueioporsolicitacaoliberacaomatricula IS TRUE))
27. 0.028 0.060 ↓ 0.0 0 2

Nested Loop (cost=0.42..3.98 rows=1 width=4) (actual time=0.030..0.030 rows=0 loops=2)

28. 0.014 0.014 ↑ 1.0 1 2

Index Scan using idx_matriculaperiodo_matricula_ano_semestre on matriculaperiodo mp_1 (cost=0.42..2.64 rows=1 width=17) (actual time=0.007..0.007 rows=1 loops=2)

  • Index Cond: ((matricula)::text = (matriculaperiodo.matricula)::text)
29. 0.018 0.018 ↓ 0.0 0 2

Seq Scan on pendencialiberacaomatricula (cost=0.00..1.33 rows=1 width=19) (actual time=0.009..0.009 rows=0 loops=2)

  • Filter: ((usuariodeferimento IS NULL) AND (usuarioindeferimento IS NULL) AND ((matricula)::text = (matriculaperiodo.matricula)::text) AND ((situacao)::text = 'PENDENTE'::text) AND (usuariosolicitacao = 87894))
  • Rows Removed by Filter: 19
30. 0.000 0.000 ↓ 0.0 0

Index Scan using pessoa_pkey on pessoa (cost=0.42..0.58 rows=1 width=43) (never executed)

  • Index Cond: (codigo = matricula.aluno)
31. 0.000 0.000 ↓ 0.0 0

Index Scan using unidadeensino_pkey on unidadeensino (cost=0.14..0.16 rows=1 width=20) (never executed)

  • Index Cond: (codigo = matricula.unidadeensino)
32. 0.000 0.000 ↓ 0.0 0

Index Scan using curso_pkey on curso (cost=0.27..0.29 rows=1 width=55) (never executed)

  • Index Cond: (codigo = matricula.curso)
33. 0.000 0.000 ↓ 0.0 0

Index Scan using periodoletivo_pkey on periodoletivo (cost=0.28..0.30 rows=1 width=24) (never executed)

  • Index Cond: (codigo = matriculaperiodo.periodoletivomatricula)
34. 0.000 0.000 ↓ 0.0 0

Index Scan using gradecurricular_pkey on gradecurricular (cost=0.28..0.30 rows=1 width=64) (never executed)

  • Index Cond: (codigo = matriculaperiodo.gradecurricular)
35. 0.000 0.000 ↓ 0.0 0

Index Scan using gradecurricular_pkey on gradecurricular gradecurricularatual (cost=0.28..0.30 rows=1 width=64) (never executed)

  • Index Cond: (codigo = matricula.gradecurricularatual)
36. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma (cost=0.28..0.30 rows=1 width=14) (never executed)

  • Index Cond: (matriculaperiodo.turma = codigo)
37. 0.000 0.000 ↓ 0.0 0

Index Scan using turno_pkey on turno (cost=0.14..0.16 rows=1 width=19) (never executed)

  • Index Cond: (codigo = matricula.turno)
38. 0.000 0.000 ↓ 0.0 0

Index Scan using planofinanceirocurso_pkey on planofinanceirocurso (cost=0.14..0.16 rows=1 width=29) (never executed)

  • Index Cond: (matriculaperiodo.planofinanceirocurso = codigo)
39. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_condicaopagamentoplanofinanceirocurso on condicaopagamentoplanofinanceirocurso (cost=0.29..0.31 rows=1 width=13) (never executed)

  • Index Cond: (matriculaperiodo.condicaopagamentoplanofinanceirocurso = codigo)
40. 0.000 0.000 ↓ 0.0 0

Index Scan using turno_pkey on turno turnoperiodo (cost=0.14..0.16 rows=1 width=19) (never executed)

  • Index Cond: (codigo = uec.turno)
41. 0.000 0.000 ↓ 0.0 0

Index Scan using processomatricula_pkey on processomatricula (cost=0.28..0.29 rows=1 width=56) (never executed)

  • Index Cond: (codigo = matriculaperiodo.processomatricula)
Planning time : 12.015 ms
Execution time : 2,948.150 ms