explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4eqd

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 4,976.038 ↓ 0.0 0 1

HashAggregate (cost=570,338.89..570,358.51 rows=1 width=123) (actual time=4,976.038..4,976.038 rows=0 loops=1)

  • Group Key: pessoa.codigo, pessoa.nome, pessoa.email, pessoa.email2, matricula.matricula, curso.nome, unidadeensino.nome
2. 242.181 4,976.036 ↓ 0.0 0 1

Nested Loop (cost=6,888.70..570,338.87 rows=1 width=123) (actual time=4,976.036..4,976.036 rows=0 loops=1)

  • Join Filter: ((configuracoes.codigo = unidadeensino.configuracoes) AND ((configuracoes.controlarsuspensaomatriculapendenciadocumentos AND (unidadeensino.codigo = 30) AND ((matricula.situacao)::text = 'AT'::text) AND ((NOT matricula.matriculasuspensa) OR (matricula.matriculasuspensa IS NULL)) AND (SubPlan 3) AND ((SubPlan 5) >= ('now'::cstring)::date) AND ((SubPlan 7) <= (('now'::cstring)::date - configuracoes.nrdiasquartoavisoriscosuspensao)) AND (matricula.dataenvionotificacao3 IS NOT NULL) AND (matricula.dataenvionotificacao4 IS NULL)) OR (((('now'::cstring)::date - configuracoes.periodicidadequartoavisoriscosuspensao) = matricula.dataenvionotificacao4) AND (configuracoes.nrdiasterceiroavisoriscosuspensao IS NOT NULL) AND (configuracoes.nrdiasquartoavisoriscosuspensao > 0))))
  • Rows Removed by Join Filter: 128702
3. 139.799 4,476.451 ↓ 128,702.0 128,702 1

Nested Loop (cost=6,888.56..570,221.14 rows=1 width=157) (actual time=163.692..4,476.451 rows=128,702 loops=1)

4. 242.311 4,079.248 ↓ 128,702.0 128,702 1

Nested Loop (cost=6,888.28..570,220.84 rows=1 width=111) (actual time=163.665..4,079.248 rows=128,702 loops=1)

5. 652.097 3,193.427 ↓ 128,702.0 128,702 1

Hash Join (cost=6,887.86..570,219.98 rows=1 width=68) (actual time=163.616..3,193.427 rows=128,702 loops=1)

  • Hash Cond: (((matricula.matricula)::text = (matriculaperiodo.matricula)::text) AND ((SubPlan 2) = matriculaperiodo.codigo))
6. 60.798 60.798 ↑ 1.0 128,752 1

Seq Scan on matricula (cost=0.00..4,015.87 rows=132,187 width=37) (actual time=0.013..60.798 rows=128,752 loops=1)

7. 62.998 163.446 ↓ 1.0 130,984 1

Hash (cost=4,936.21..4,936.21 rows=130,110 width=48) (actual time=163.446..163.446 rows=130,984 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 11312kB
8. 64.243 100.448 ↓ 1.0 130,984 1

Nested Loop (cost=0.00..4,936.21 rows=130,110 width=48) (actual time=0.015..100.448 rows=130,984 loops=1)

9. 0.005 0.005 ↑ 1.0 1 1

Seq Scan on configuracoes (cost=0.00..1.01 rows=1 width=17) (actual time=0.005..0.005 rows=1 loops=1)

10. 36.200 36.200 ↓ 1.0 130,984 1

Seq Scan on matriculaperiodo (cost=0.00..3,634.10 rows=130,110 width=31) (actual time=0.007..36.200 rows=130,984 loops=1)

11.          

SubPlan (forHash Join)

12. 257.454 2,317.086 ↑ 1.0 1 257,454

Aggregate (cost=8.44..8.45 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=257,454)

13. 2,059.632 2,059.632 ↑ 1.0 1 257,454

Index Scan using idx_matriculaperiodo_matricula_ano_semestre on matriculaperiodo mp (cost=0.42..8.44 rows=1 width=4) (actual time=0.008..0.008 rows=1 loops=257,454)

  • Index Cond: ((matricula)::text = (matricula.matricula)::text)
14. 643.510 643.510 ↑ 1.0 1 128,702

Index Scan using pessoa_pkey on pessoa (cost=0.42..0.84 rows=1 width=47) (actual time=0.005..0.005 rows=1 loops=128,702)

  • Index Cond: (codigo = matricula.aluno)
15. 257.404 257.404 ↑ 1.0 1 128,702

Index Scan using curso_pkey on curso (cost=0.27..0.29 rows=1 width=54) (actual time=0.002..0.002 rows=1 loops=128,702)

  • Index Cond: (codigo = matricula.curso)
16. 257.404 257.404 ↑ 1.0 1 128,702

Index Scan using unidadeensino_pkey on unidadeensino (cost=0.14..0.17 rows=1 width=24) (actual time=0.001..0.002 rows=1 loops=128,702)

  • Index Cond: (codigo = matricula.unidadeensino)
17.          

SubPlan (forNested Loop)

18. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.42..12.77 rows=1 width=13) (never executed)

19. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_documetacaomatricula_matricula on documetacaomatricula dm (cost=0.42..12.77 rows=1 width=13) (never executed)

  • Index Cond: ((matricula.matricula)::text = (matricula)::text)
  • Filter: ((NOT entregue) AND gerarsuspensaomatricula)
20. 0.000 0.000 ↓ 0.0 0

Limit (cost=15.23..55.46 rows=1 width=8) (never executed)

21. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=15.23..427,383.06 rows=10,623 width=8) (never executed)

  • Join Filter: (horarioturmadia.horarioturma = horarioturma.codigo)
22. 0.000 0.000 ↓ 0.0 0

Index Scan Backward using idx_horarioturmadia_data on horarioturmadia (cost=0.42..3,732.00 rows=42,460 width=12) (never executed)

  • Index Cond: (data >= matriculaperiodo.data)
23. 0.000 0.000 ↓ 0.0 0

Materialize (cost=14.81..114.23 rows=665 width=4) (never executed)

24. 0.000 0.000 ↓ 0.0 0

Seq Scan on horarioturma (cost=14.81..110.91 rows=665 width=4) (never executed)

  • Filter: (((turma = matriculaperiodo.turma) OR (hashed SubPlan 4)) AND CASE curso.periodicidade WHEN 'SE'::text THEN (((anovigente)::text = (matriculaperiodo.ano)::text) AND ((semestrevigente)::text = (matriculaperiodo.semestre)::text)) WHEN 'AN'::text THEN ((anovigente)::text = (matriculaperiodo.ano)::text) ELSE true END)
25.          

SubPlan (forSeq Scan)

26. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on turmaagrupada (cost=4.23..14.79 rows=10 width=4) (never executed)

  • Recheck Cond: (turma = matriculaperiodo.turma)
27. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_turmaagrupada_turma (cost=0.00..4.23 rows=10 width=0) (never executed)

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

Limit (cost=15.23..55.46 rows=1 width=8) (never executed)

29. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=15.23..427,383.06 rows=10,623 width=8) (never executed)

  • Join Filter: (horarioturmadia_1.horarioturma = horarioturma_1.codigo)
30. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_horarioturmadia_data on horarioturmadia horarioturmadia_1 (cost=0.42..3,732.00 rows=42,460 width=12) (never executed)

  • Index Cond: (data >= matriculaperiodo.data)
31. 0.000 0.000 ↓ 0.0 0

Materialize (cost=14.81..114.23 rows=665 width=4) (never executed)

32. 0.000 0.000 ↓ 0.0 0

Seq Scan on horarioturma horarioturma_1 (cost=14.81..110.91 rows=665 width=4) (never executed)

  • Filter: (((turma = matriculaperiodo.turma) OR (hashed SubPlan 6)) AND CASE curso.periodicidade WHEN 'SE'::text THEN (((anovigente)::text = (matriculaperiodo.ano)::text) AND ((semestrevigente)::text = (matriculaperiodo.semestre)::text)) WHEN 'AN'::text THEN ((anovigente)::text = (matriculaperiodo.ano)::text) ELSE true END)
33.          

SubPlan (forSeq Scan)

34. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on turmaagrupada turmaagrupada_1 (cost=4.23..14.79 rows=10 width=4) (never executed)

  • Recheck Cond: (turma = matriculaperiodo.turma)
35. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_turmaagrupada_turma (cost=0.00..4.23 rows=10 width=0) (never executed)

  • Index Cond: (turma = matriculaperiodo.turma)
36.          

SubPlan (forHashAggregate)

37. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=12.78..19.61 rows=1 width=38) (never executed)

  • Hash Cond: (tipodocumento.codigo = documetacaomatricula.tipodedocumento)
38. 0.000 0.000 ↓ 0.0 0

Seq Scan on tipodocumento (cost=0.00..6.05 rows=205 width=42) (never executed)

39. 0.000 0.000 ↓ 0.0 0

Hash (cost=12.77..12.77 rows=1 width=4) (never executed)

40. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_documetacaomatricula_matricula on documetacaomatricula (cost=0.42..12.77 rows=1 width=4) (never executed)

  • Index Cond: ((matricula)::text = (matricula.matricula)::text)
  • Filter: (NOT entregue)