explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sqyh

Settings
# exclusive inclusive rows x rows loops node
1. 0.399 11,789.378 ↑ 135.9 65 1

Sort (cost=10,062,984.43..10,063,006.52 rows=8,835 width=398) (actual time=11,789.290..11,789.378 rows=65 loops=1)

  • Sort Key: t."Pessoa.nome
  • Sort Method: quicksort Memory: 58kB
2. 0.561 11,788.979 ↑ 135.9 65 1

Subquery Scan on t (cost=640,976.27..10,062,405.34 rows=8,835 width=398) (actual time=11,788.206..11,788.979 rows=65 loops=1)

  • Filter: ((alternatives: SubPlan 12 or hashed SubPlan 24) OR (NOT (alternatives: SubPlan 36 or hashed SubPlan 48)))
3. 0.357 11,622.760 ↑ 181.2 65 1

Unique (cost=640,976.27..642,949.42 rows=11,780 width=398) (actual time=11,622.313..11,622.760 rows=65 loops=1)

4. 13.060 11,622.403 ↑ 181.2 65 1

Sort (cost=640,976.27..641,005.72 rows=11,780 width=398) (actual time=11,622.309..11,622.403 rows=65 loops=1)

  • Sort Key: matriculaperiodoturmadisciplina.matricula, matriculaperiodoturmadisciplina.turma, matriculaperiodoturmadisciplina.turmateorica, matriculaperiodoturmadisciplina.turmapratica, matriculaperiodoturmadisciplina.permiteescolhermodalidade, matriculaperiodoturmadisciplina.conteudo, matriculaperiodoturmadisciplina.modalidadedisciplina, matriculaperiodoturmadisciplina.matriculaperiodo, matriculaperiodoturmadisciplina.semestre, matriculaperiodoturmadisciplina.ano, matriculaperiodoturmadisciplina.codigo, matriculaperiodoturmadisciplina.disciplina, matriculaperiodoturmadisciplina.disciplinaincluida, matriculaperiodoturmadisciplina.disciplinaequivale, matriculaperiodoturmadisciplina.disciplinaequivalente, matriculaperiodoturmadisciplina.disciplinafazpartecomposicao, matriculaperiodoturmadisciplina.justificativa, matriculaperiodoturmadisciplina.observacaojustificativa, matriculaperiodoturmadisciplina.inclusaoforaprazo, matriculaperiodo.data, matriculaperiodo.situacao, matriculaperiodo.alunotransferidounidade, matriculaperiodo.situacaomatriculaperiodo, matriculaperiodo.datafechamentomatriculaperiodo, matriculaperiodo.unidadeensinocurso, matriculaperiodo.processomatricula, matriculaperiodo.gradecurricular, matriculaperiodo.turma, matriculaperiodo.periodoletivomatricula, matricula.gradecurricularatual, matricula.data, matricula.matriculasuspensa, matricula.updated, matricula.turno, matricula.situacao, matricula.situacaofinanceira, pessoa.nome, pessoa.codigo, pessoa.cpf, turma.semestral, turma.anual, turma.identificadorturma, turma.turmaagrupada, turma.sala, turma.gradecurricular, turma.chancela, turma.tipochancela, turma.porcentagemchancela, turma.valorfixochancela, turma.valorporaluno, turma.qtdalunosestimado, turma.customedioaluno, turma.receitamediaaluno, chancela.instituicaochanceladora, unidadeensino.codigo, unidadeensino.nome, curso.codigo, curso.nome, curso.periodicidade, curso.configuracaoacademico, curso.niveleducacional, turno.codigo, turno.nome, periodoletivo.descricao, periodoletivo.codigo, historico.dataregistro
  • Sort Method: quicksort Memory: 58kB
5. 0.330 11,609.343 ↑ 181.2 65 1

Hash Left Join (cost=252,521.38..640,179.70 rows=11,780 width=398) (actual time=7,484.310..11,609.343 rows=65 loops=1)

  • Hash Cond: (turma.chancela = chancela.codigo)
6. 0.325 11,608.989 ↑ 181.2 65 1

Hash Left Join (cost=252,520.18..639,207.22 rows=11,780 width=364) (actual time=7,484.245..11,608.989 rows=65 loops=1)

  • Hash Cond: (turma.periodoletivo = periodoletivo.codigo)
7. 0.288 11,604.429 ↑ 181.2 65 1

Hash Left Join (cost=252,297.81..638,952.81 rows=11,780 width=349) (actual time=7,479.972..11,604.429 rows=65 loops=1)

  • Hash Cond: (turma.turno = turno.codigo)
8. 0.342 11,604.020 ↑ 181.2 65 1

Hash Left Join (cost=252,291.75..638,868.19 rows=11,780 width=334) (actual time=7,479.814..11,604.020 rows=65 loops=1)

  • Hash Cond: (turma.unidadeensino = unidadeensino.codigo)
9. 0.439 11,603.071 ↑ 181.2 65 1

Nested Loop (cost=252,202.40..638,732.86 rows=11,780 width=318) (actual time=7,479.163..11,603.071 rows=65 loops=1)

10. 0.333 11,601.722 ↑ 181.2 65 1

Hash Join (cost=252,201.98..631,016.30 rows=11,780 width=279) (actual time=7,479.111..11,601.722 rows=65 loops=1)

  • Hash Cond: (matricula.curso = curso.codigo)
  • Join Filter: (((curso.periodicidade)::text = 'IN'::text) OR (((curso.periodicidade)::text = ANY ('{AN,SE}'::text[])) AND (SubPlan 49)))
11. 0.000 11,599.240 ↑ 182.7 65 1

Hash Join (cost=252,038.48..630,764.33 rows=11,878 width=234) (actual time=7,476.927..11,599.240 rows=65 loops=1)

  • Hash Cond: ((matriculaperiodoturmadisciplina.matricula)::text = (matricula.matricula)::text)
  • Join Filter: (((matricula.gradecurricularatual = historico.matrizcurricular) AND ((historico.historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historico.historicocursandoporcorrespondenciaapostransferencia)) AND ((historico.transferenciamatrizcurricularmatricula IS NULL) OR ((historico.transferenciamatrizcurricularmatricula IS NOT NULL) AND (NOT (SubPlan 56))))) OR ((matricula.gradecurricularatual <> historico.matrizcurricular) AND historico.historicocursandoporcorrespondenciaapostransferencia AND (historico.transferenciamatrizcurricularmatricula IS NOT NULL) AND (historico.disciplina = (SubPlan 57)) AND ((NOT historico.historicoporequivalencia) OR (historico.historicoporequivalencia IS NULL))) OR ((matricula.gradecurricularatual <> historico.matrizcurricular) AND historico.historicoequivalente AND (SubPlan 58)) OR ((historico.matrizcurricular = matriculaperiodo.gradecurricular) AND (matricula.gradecurricularatual <> historico.matrizcurricular) AND historico.historicodisciplinafazpartecomposicao AND (NOT (SubPlan 59))))
12. 76.818 10,822.957 ↑ 23,404.3 65 1

Gather (cost=212,246.93..586,979.42 rows=1,521,280 width=225) (actual time=6,681.973..10,822.957 rows=65 loops=1)

  • Workers Planned: 3
  • Workers Launched: 3
13. 1,381.751 10,746.139 ↑ 30,670.9 16 4 / 4

Parallel Hash Join (cost=211,246.93..433,851.42 rows=490,735 width=225) (actual time=6,702.226..10,746.139 rows=16 loops=4)

  • Hash Cond: (historico.matriculaperiodoturmadisciplina = matriculaperiodoturmadisciplina.codigo)
14. 3,234.084 3,234.084 ↑ 1.3 708,192 4 / 4

Parallel Seq Scan on historico (cost=0.00..203,810.17 rows=917,046 width=56) (actual time=0.056..3,234.084 rows=708,192 loops=4)

  • Filter: ((situacao)::text <> ALL ('{AA,CC,CH,IS}'::text[]))
  • Rows Removed by Filter: 8,436
15. 1.113 6,130.304 ↑ 30,094.1 16 4 / 4

Parallel Hash (cost=161,892.56..161,892.56 rows=481,506 width=173) (actual time=6,130.303..6,130.304 rows=16 loops=4)

  • Buckets: 2,097,152 Batches: 1 Memory Usage: 16,512kB
16. 0.493 6,129.191 ↑ 30,094.1 16 4 / 4

Hash Join (cost=24,164.14..161,892.56 rows=481,506 width=173) (actual time=1,150.718..6,129.191 rows=16 loops=4)

  • Hash Cond: (matriculaperiodoturmadisciplina.disciplina = disciplina.codigo)
17. 1,448.003 6,126.164 ↑ 2,866.2 192 4 / 4

Hash Join (cost=22,766.61..159,042.16 rows=550,316 width=173) (actual time=515.276..6,126.164 rows=192 loops=4)

  • Hash Cond: (matriculaperiodoturmadisciplina.turma = turma.codigo)
  • Join Filter: ((turma.codigo = 97,392) OR (hashed SubPlan 50) OR (hashed SubPlan 51) OR (hashed SubPlan 52))
  • Rows Removed by Join Filter: 514,301
18. 2,955.537 4,564.564 ↑ 1.2 514,493 4 / 4

Parallel Hash Join (cost=18,315.21..152,936.50 rows=628,927 width=112) (actual time=231.146..4,564.564 rows=514,493 loops=4)

  • Hash Cond: (matriculaperiodoturmadisciplina.matriculaperiodo = matriculaperiodo.codigo)
19. 1,380.468 1,380.468 ↑ 1.3 697,399 4 / 4

Parallel Seq Scan on matriculaperiodoturmadisciplina (cost=0.00..132,258.81 rows=899,798 width=65) (actual time=0.025..1,380.468 rows=697,399 loops=4)

20. 101.865 228.559 ↑ 1.7 31,121 4 / 4

Parallel Hash (cost=13,002.95..13,002.95 rows=51,827 width=47) (actual time=228.556..228.559 rows=31,121 loops=4)

  • Buckets: 131,072 Batches: 1 Memory Usage: 11,808kB
21. 126.694 126.694 ↑ 1.7 31,121 4 / 4

Parallel Seq Scan on matriculaperiodo (cost=0.00..13,002.95 rows=51,827 width=47) (actual time=3.220..126.694 rows=31,121 loops=4)

  • Filter: (((situacaomatriculaperiodo)::text = ANY ('{AT,FO,FI}'::text[])) AND ((situacao)::text = ANY ('{PF,CO,AT}'::text[])))
  • Rows Removed by Filter: 13,394
22. 55.100 112.058 ↑ 1.0 18,425 4 / 4

Hash (cost=2,267.50..2,267.50 rows=18,425 width=61) (actual time=112.057..112.058 rows=18,425 loops=4)

  • Buckets: 32,768 Batches: 1 Memory Usage: 2,054kB
23. 56.958 56.958 ↑ 1.0 18,425 4 / 4

Seq Scan on turma (cost=0.00..2,267.50 rows=18,425 width=61) (actual time=0.047..56.958 rows=18,425 loops=4)

24.          

SubPlan (for Hash Join)

25. 0.230 0.230 ↓ 1.3 50 4 / 4

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_12 (cost=0.29..33.79 rows=38 width=4) (actual time=0.129..0.230 rows=50 loops=4)

  • Index Cond: (turmaorigem = 97,392)
26. 0.003 0.732 ↓ 0.0 0 4 / 4

Nested Loop (cost=0.86..130.72 rows=1 width=4) (actual time=0.731..0.732 rows=0 loops=4)

27. 0.210 0.729 ↓ 0.0 0 4 / 4

Nested Loop (cost=0.57..128.03 rows=1 width=8) (actual time=0.728..0.729 rows=0 loops=4)

28. 0.119 0.119 ↓ 1.3 50 4 / 4

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_13 (cost=0.29..33.79 rows=38 width=8) (actual time=0.021..0.119 rows=50 loops=4)

  • Index Cond: (turmaorigem = 97,392)
29. 0.400 0.400 ↓ 0.0 0 200 / 4

Index Scan using turma_pkey on turma turma_13 (cost=0.29..2.42 rows=1 width=4) (actual time=0.008..0.008 rows=0 loops=200)

  • Index Cond: (codigo = turmaagrupada_13.turma)
  • Filter: ((tiposubturma)::text = 'PRATICA'::text)
  • Rows Removed by Filter: 1
30. 0.000 0.000 ↓ 0.0 0 / 4

Index Scan using turma_pkey on turma turmaorigem_8 (cost=0.29..2.60 rows=1 width=4) (never executed)

  • Index Cond: (codigo = 97,392)
  • Filter: (NOT subturma)
31. 0.002 0.577 ↓ 0.0 0 4 / 4

Nested Loop (cost=0.86..130.72 rows=1 width=4) (actual time=0.576..0.577 rows=0 loops=4)

32. 0.162 0.575 ↓ 0.0 0 4 / 4

Nested Loop (cost=0.57..128.03 rows=1 width=8) (actual time=0.573..0.575 rows=0 loops=4)

33. 0.113 0.113 ↓ 1.3 50 4 / 4

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_14 (cost=0.29..33.79 rows=38 width=8) (actual time=0.017..0.113 rows=50 loops=4)

  • Index Cond: (turmaorigem = 97,392)
34. 0.300 0.300 ↓ 0.0 0 200 / 4

Index Scan using turma_pkey on turma turma_14 (cost=0.29..2.42 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=200)

  • Index Cond: (codigo = turmaagrupada_14.turma)
  • Filter: ((tiposubturma)::text = 'TEORICA'::text)
  • Rows Removed by Filter: 1
35. 0.000 0.000 ↓ 0.0 0 / 4

Index Scan using turma_pkey on turma turmaorigem_9 (cost=0.29..2.60 rows=1 width=4) (never executed)

  • Index Cond: (codigo = 97,392)
  • Filter: (NOT subturma)
36. 0.012 2.534 ↑ 5,843.0 1 4 / 4

Hash (cost=798.62..798.62 rows=5,843 width=4) (actual time=2.532..2.534 rows=1 loops=4)

  • Buckets: 8,192 Batches: 1 Memory Usage: 65kB
37. 2.359 2.522 ↑ 5,843.0 1 4 / 4

Index Only Scan using disciplina_pkey on disciplina (cost=7.55..798.62 rows=5,843 width=4) (actual time=2.333..2.522 rows=1 loops=4)

  • Filter: ((codigo = 7,459) OR (hashed SubPlan 53) OR (hashed SubPlan 54) OR (hashed SubPlan 55))
  • Rows Removed by Filter: 6,677
  • Heap Fetches: 0
38.          

SubPlan (for Index Only Scan)

39. 0.094 0.094 ↑ 1.0 1 4 / 4

Index Scan using idx_turmadisciplina_turma_disciplina on turmadisciplina turmadisciplina_4 (cost=0.42..2.73 rows=1 width=4) (actual time=0.090..0.094 rows=1 loops=4)

  • Index Cond: ((turma = 97,392) AND (disciplina = 7,459))
40. 0.049 0.049 ↓ 0.0 0 4 / 4

Index Only Scan using disciplinaequivalente_pkey on disciplinaequivalente disciplinaequivalente_8 (cost=0.14..1.35 rows=1 width=4) (actual time=0.048..0.049 rows=0 loops=4)

  • Index Cond: (disciplina = 7,459)
  • Heap Fetches: 0
41. 0.020 0.020 ↓ 0.0 0 4 / 4

Index Only Scan using disciplinaequivalente_pkey on disciplinaequivalente disciplinaequivalente_9 (cost=0.14..3.19 rows=1 width=4) (actual time=0.019..0.020 rows=0 loops=4)

  • Index Cond: (equivalente = 7,459)
  • Heap Fetches: 0
42. 381.146 793.355 ↓ 1.0 174,001 1

Hash (cost=21,966.90..21,966.90 rows=173,899 width=53) (actual time=793.354..793.355 rows=174,001 loops=1)

  • Buckets: 262,144 Batches: 1 Memory Usage: 18,563kB
43. 412.209 412.209 ↓ 1.0 174,001 1

Seq Scan on matricula (cost=0.00..21,966.90 rows=173,899 width=53) (actual time=0.014..412.209 rows=174,001 loops=1)

44.          

SubPlan (for Hash Join)

45. 0.000 0.000 ↓ 0.0 0

Limit (cost=13.17..14.38 rows=1 width=4) (never executed)

46. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_16 (cost=13.17..14.38 rows=1 width=4) (never executed)

  • Recheck Cond: (((matricula)::text = (historico.matricula)::text) AND (disciplina = historico.disciplina))
  • Filter: (historicocursandoporcorrespondenciaapostransferencia AND (matrizcurricular <> matricula.gradecurricularatual) AND ((anohistorico)::text = (historico.anohistorico)::text) AND ((semestrehistorico)::text = (historico.semestrehistorico)::text) AND (transferenciamatrizcurricularmatricula = historico.transferenciamatrizcurricularmatricula))
47. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

48. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico.matricula)::text)
49. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = historico.disciplina)
50. 0.000 0.000 ↓ 0.0 0

Limit (cost=13.17..14.38 rows=1 width=4) (never executed)

51. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_17 (cost=13.17..14.38 rows=1 width=4) (never executed)

  • Recheck Cond: (((matricula)::text = (historico.matricula)::text) AND (disciplina = historico.disciplina))
  • Filter: (((historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historicocursandoporcorrespondenciaapostransferencia)) AND ((anohistorico)::text = (historico.anohistorico)::text) AND ((semestrehistorico)::text = (historico.semestrehistorico)::text) AND (transferenciamatrizcurricularmatricula = historico.transferenciamatrizcurricularmatricula) AND (matrizcurricular = matricula.gradecurricularatual))
52. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

53. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico.matricula)::text)
54. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = historico.disciplina)
55. 0.000 0.000 ↓ 0.0 0

Nested Loop Semi Join (cost=13.60..41.80 rows=1 width=0) (never executed)

56. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_historico_matricula on historico hist_4 (cost=0.43..27.32 rows=1 width=24) (never executed)

  • Index Cond: ((matricula)::text = (historico.matricula)::text)
  • Filter: (historicoporequivalencia AND (historico.mapaequivalenciadisciplina = mapaequivalenciadisciplina) AND (numeroagrupamentoequivalenciadisciplina = historico.numeroagrupamentoequivalenciadisciplina))
57. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_18 (cost=13.17..14.38 rows=1 width=24) (never executed)

  • Recheck Cond: (((matricula)::text = (historico.matricula)::text) AND (disciplina = hist_4.disciplina))
  • Filter: (((historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historicocursandoporcorrespondenciaapostransferencia)) AND (matrizcurricular = matricula.gradecurricularatual) AND ((hist_4.anohistorico)::text = (anohistorico)::text) AND ((hist_4.semestrehistorico)::text = (semestrehistorico)::text) AND (hist_4.transferenciamatrizcurricularmatricula = transferenciamatrizcurricularmatricula))
58. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

59. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico.matricula)::text)
60. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = hist_4.disciplina)
61. 0.000 0.000 ↓ 0.0 0

Index Only Scan using unq_historico_disciplina_matrper_matrperturm_grade_gd_gcgod on historico his_19 (cost=0.56..1.77 rows=1 width=4) (never executed)

  • Index Cond: ((disciplina = historico.disciplina) AND (matriculaperiodo = historico.matriculaperiodo) AND (matrizcurricular = matricula.gradecurricularatual))
  • Heap Fetches: 0
62. 1.028 2.149 ↑ 1.0 600 1

Hash (cost=102.00..102.00 rows=600 width=63) (actual time=2.148..2.149 rows=600 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 65kB
63. 1.121 1.121 ↑ 1.0 600 1

Seq Scan on curso (cost=0.00..102.00 rows=600 width=63) (actual time=0.012..1.121 rows=600 loops=1)

64.          

SubPlan (for Hash Join)

65. 0.000 0.000 ↓ 0.0 0

Limit (cost=2.75..2.76 rows=1 width=40) (never executed)

66. 0.000 0.000 ↓ 0.0 0

Sort (cost=2.75..2.76 rows=1 width=40) (never executed)

  • Sort Key: ((((mp_4.ano)::text || '/'::text) || (mp_4.semestre)::text)) DESC, (CASE WHEN ((mp_4.situacaomatriculaperiodo)::text = ANY ('{AT,PR,FI,FO}'::text[])) THEN 1 ELSE 2 END), mp_4.codigo DESC
67. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_matriculaperiodo_matricula_ano_semestre on matriculaperiodo mp_4 (cost=0.42..2.74 rows=1 width=40) (never executed)

  • Index Cond: (((matricula)::text = (matricula.matricula)::text) AND ((ano)::text = (matriculaperiodoturmadisciplina.ano)::text) AND ((semestre)::text = (matriculaperiodoturmadisciplina.semestre)::text))
68. 0.910 0.910 ↑ 1.0 1 65

Index Scan using pessoa_pkey on pessoa (cost=0.42..0.66 rows=1 width=43) (actual time=0.014..0.014 rows=1 loops=65)

  • Index Cond: (codigo = matricula.aluno)
69. 0.189 0.607 ↑ 1.0 79 1

Hash (cost=81.25..81.25 rows=79 width=20) (actual time=0.606..0.607 rows=79 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 13kB
70. 0.418 0.418 ↑ 1.0 79 1

Index Scan using unidadeensino_pkey on unidadeensino (cost=0.14..81.25 rows=79 width=20) (actual time=0.025..0.418 rows=79 loops=1)

71. 0.058 0.121 ↑ 1.0 25 1

Hash (cost=3.50..3.50 rows=25 width=19) (actual time=0.120..0.121 rows=25 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
72. 0.063 0.063 ↑ 1.0 25 1

Seq Scan on turno (cost=0.00..3.50 rows=25 width=19) (actual time=0.011..0.063 rows=25 loops=1)

73. 2.118 4.235 ↑ 1.0 1,029 1

Hash (cost=116.90..116.90 rows=1,029 width=19) (actual time=4.234..4.235 rows=1,029 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 70kB
74. 2.117 2.117 ↑ 1.0 1,029 1

Seq Scan on periodoletivo (cost=0.00..116.90 rows=1,029 width=19) (actual time=0.015..2.117 rows=1,029 loops=1)

75. 0.010 0.024 ↑ 1.0 1 1

Hash (cost=1.10..1.10 rows=1 width=9) (actual time=0.022..0.024 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
76. 0.014 0.014 ↑ 1.0 1 1

Seq Scan on chancela (cost=0.00..1.10 rows=1 width=9) (actual time=0.010..0.014 rows=1 loops=1)

77.          

SubPlan (for Subquery Scan)

78. 0.000 0.000 ↓ 0.0 0

Result (cost=315.53..393.84 rows=1 width=0) (never executed)

  • One-Time Filter: (t."MatriculaPeriodoTurmaDisciplina.disciplina" = 7,459)
79. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=315.53..393.84 rows=1 width=0) (never executed)

80. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=19.90..98.00 rows=1 width=12) (never executed)

81. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=19.48..97.45 rows=1 width=16) (never executed)

82. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=11.92..89.77 rows=1 width=20) (never executed)

  • Join Filter: ((((curso_1.periodicidade)::text = 'IN'::text) OR (((curso_1.periodicidade)::text = ANY ('{AN,SE}'::text[])) AND (SubPlan 1))) AND (((matricula_1.gradecurricularatual = historico_1.matrizcurricular) AND ((historico_1.historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historico_1.historicocursandoporcorrespondenciaapostransferencia)) AND ((historico_1.transferenciamatrizcurricularmatricula IS NULL) OR ((historico_1.transferenciamatrizcurricularmatricula IS NOT NULL) AND (NOT (SubPlan 8))))) OR ((matricula_1.gradecurricularatual <> historico_1.matrizcurricular) AND historico_1.historicocursandoporcorrespondenciaapostransferencia AND (historico_1.transferenciamatrizcurricularmatricula IS NOT NULL) AND (historico_1.disciplina = (SubPlan 9)) AND ((NOT historico_1.historicoporequivalencia) OR (historico_1.historicoporequivalencia IS NULL))) OR ((matricula_1.gradecurricularatual <> historico_1.matrizcurricular) AND historico_1.historicoequivalente AND (SubPlan 10)) OR ((historico_1.matrizcurricular = matriculaperiodo_1.gradecurricular) AND (matricula_1.gradecurricularatual <> historico_1.matrizcurricular) AND historico_1.historicodisciplinafazpartecomposicao AND (NOT (SubPlan 11)))))
83. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=11.50..15.24 rows=1 width=91) (never executed)

84. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=11.23..14.86 rows=1 width=92) (never executed)

85. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=10.81..14.33 rows=1 width=80) (never executed)

86. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico historico_1 (cost=10.38..11.59 rows=1 width=48) (never executed)

  • Recheck Cond: (((matricula)::text = (t."MatriculaPeriodoTurmaDisciplina.matricula")::text) AND (disciplina = 7,459))
  • Filter: ((situacao)::text <> ALL ('{AA,CC,CH,IS}'::text[]))
87. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=10.38..10.38 rows=1 width=0) (never executed)

88. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (t."MatriculaPeriodoTurmaDisciplina.matricula")::text)
89. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..8.43 rows=627 width=0) (never executed)

  • Index Cond: (disciplina = 7,459)
90. 0.000 0.000 ↓ 0.0 0

Index Scan using matriculaperiodoturmadisciplina_pkey on matriculaperiodoturmadisciplina matriculaperiodoturmadisciplina_1 (cost=0.43..2.74 rows=1 width=40) (never executed)

  • Index Cond: (codigo = historico_1.matriculaperiodoturmadisciplina)
91. 0.000 0.000 ↓ 0.0 0

Index Scan using matricula_pkey on matricula matricula_1 (cost=0.42..0.53 rows=1 width=26) (never executed)

  • Index Cond: ((matricula)::text = (matriculaperiodoturmadisciplina_1.matricula)::text)
92. 0.000 0.000 ↓ 0.0 0

Index Scan using curso_pkey on curso curso_1 (cost=0.28..0.38 rows=1 width=7) (never executed)

  • Index Cond: (codigo = matricula_1.curso)
93. 0.000 0.000 ↓ 0.0 0

Index Scan using matriculaperiodo_pkey on matriculaperiodo matriculaperiodo_1 (cost=0.42..0.54 rows=1 width=8) (never executed)

  • Index Cond: (codigo = matriculaperiodoturmadisciplina_1.matriculaperiodo)
  • Filter: (((situacaomatriculaperiodo)::text = ANY ('{AT,FO,FI}'::text[])) AND ((situacao)::text = ANY ('{PF,CO,AT}'::text[])))
94.          

SubPlan (for Nested Loop)

95. 0.000 0.000 ↓ 0.0 0

Limit (cost=2.75..2.76 rows=1 width=40) (never executed)

96. 0.000 0.000 ↓ 0.0 0

Sort (cost=2.75..2.76 rows=1 width=40) (never executed)

  • Sort Key: ((((mp.ano)::text || '/'::text) || (mp.semestre)::text)) DESC, (CASE WHEN ((mp.situacaomatriculaperiodo)::text = ANY ('{AT,PR,FI,FO}'::text[])) THEN 1 ELSE 2 END), mp.codigo DESC
97. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_matriculaperiodo_matricula_ano_semestre on matriculaperiodo mp (cost=0.42..2.74 rows=1 width=40) (never executed)

  • Index Cond: (((matricula)::text = (matricula_1.matricula)::text) AND ((ano)::text = (matriculaperiodoturmadisciplina_1.ano)::text) AND ((semestre)::text = (matriculaperiodoturmadisciplina_1.semestre)::text))
98. 0.000 0.000 ↓ 0.0 0

Limit (cost=13.17..14.38 rows=1 width=4) (never executed)

99. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his (cost=13.17..14.38 rows=1 width=4) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_1.matricula)::text) AND (disciplina = historico_1.disciplina))
  • Filter: (historicocursandoporcorrespondenciaapostransferencia AND (matrizcurricular <> matricula_1.gradecurricularatual) AND ((anohistorico)::text = (historico_1.anohistorico)::text) AND ((semestrehistorico)::text = (historico_1.semestrehistorico)::text) AND (transferenciamatrizcurricularmatricula = historico_1.transferenciamatrizcurricularmatricula))
100. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

101. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_1.matricula)::text)
102. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = historico_1.disciplina)
103. 0.000 0.000 ↓ 0.0 0

Limit (cost=13.17..14.38 rows=1 width=4) (never executed)

104. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_1 (cost=13.17..14.38 rows=1 width=4) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_1.matricula)::text) AND (disciplina = historico_1.disciplina))
  • Filter: (((historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historicocursandoporcorrespondenciaapostransferencia)) AND ((anohistorico)::text = (historico_1.anohistorico)::text) AND ((semestrehistorico)::text = (historico_1.semestrehistorico)::text) AND (transferenciamatrizcurricularmatricula = historico_1.transferenciamatrizcurricularmatricula) AND (matrizcurricular = matricula_1.gradecurricularatual))
105. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

106. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_1.matricula)::text)
107. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = historico_1.disciplina)
108. 0.000 0.000 ↓ 0.0 0

Nested Loop Semi Join (cost=13.60..41.80 rows=1 width=0) (never executed)

109. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_historico_matricula on historico hist (cost=0.43..27.32 rows=1 width=24) (never executed)

  • Index Cond: ((matricula)::text = (historico_1.matricula)::text)
  • Filter: (historicoporequivalencia AND (historico_1.mapaequivalenciadisciplina = mapaequivalenciadisciplina) AND (numeroagrupamentoequivalenciadisciplina = historico_1.numeroagrupamentoequivalenciadisciplina))
110. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_2 (cost=13.17..14.38 rows=1 width=24) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_1.matricula)::text) AND (disciplina = hist.disciplina))
  • Filter: (((historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historicocursandoporcorrespondenciaapostransferencia)) AND (matrizcurricular = matricula_1.gradecurricularatual) AND ((hist.anohistorico)::text = (anohistorico)::text) AND ((hist.semestrehistorico)::text = (semestrehistorico)::text) AND (hist.transferenciamatrizcurricularmatricula = transferenciamatrizcurricularmatricula))
111. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

112. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_1.matricula)::text)
113. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = hist.disciplina)
114. 0.000 0.000 ↓ 0.0 0

Index Only Scan using unq_historico_disciplina_matrper_matrperturm_grade_gd_gcgod on historico his_3 (cost=0.56..1.77 rows=1 width=4) (never executed)

  • Index Cond: ((disciplina = historico_1.disciplina) AND (matriculaperiodo = historico_1.matriculaperiodo) AND (matrizcurricular = matricula_1.gradecurricularatual))
  • Heap Fetches: 0
115. 0.000 0.000 ↓ 0.0 0

Index Only Scan using disciplina_pkey on disciplina disciplina_1 (cost=7.55..7.67 rows=1 width=4) (never executed)

  • Index Cond: (codigo = matriculaperiodoturmadisciplina_1.disciplina)
  • Filter: ((codigo = 7,459) OR (hashed SubPlan 5) OR (hashed SubPlan 6) OR (hashed SubPlan 7))
  • Heap Fetches: 0
116.          

SubPlan (for Index Only Scan)

117. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmadisciplina_turma_disciplina on turmadisciplina (cost=0.42..2.73 rows=1 width=4) (never executed)

  • Index Cond: ((turma = 97,392) AND (disciplina = 7,459))
118. 0.000 0.000 ↓ 0.0 0

Index Only Scan using disciplinaequivalente_pkey on disciplinaequivalente (cost=0.14..1.35 rows=1 width=4) (never executed)

  • Index Cond: (disciplina = 7,459)
  • Heap Fetches: 0
119. 0.000 0.000 ↓ 0.0 0

Index Only Scan using disciplinaequivalente_pkey on disciplinaequivalente disciplinaequivalente_1 (cost=0.14..3.19 rows=1 width=4) (never executed)

  • Index Cond: (equivalente = 7,459)
  • Heap Fetches: 0
120. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pessoa_pkey on pessoa pessoa_1 (cost=0.42..0.55 rows=1 width=4) (never executed)

  • Index Cond: (codigo = matricula_1.aluno)
  • Heap Fetches: 0
121. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turma_3 (cost=295.62..295.74 rows=1 width=24) (never executed)

  • Index Cond: (codigo = matriculaperiodoturmadisciplina_1.turma)
  • Filter: ((codigo = 97,392) OR (hashed SubPlan 2) OR (hashed SubPlan 3) OR (hashed SubPlan 4))
122.          

SubPlan (for Index Scan)

123. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada (cost=0.29..33.79 rows=38 width=4) (never executed)

  • Index Cond: (turmaorigem = 97,392)
124. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..130.72 rows=1 width=4) (never executed)

125. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.57..128.03 rows=1 width=8) (never executed)

126. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_1 (cost=0.29..33.79 rows=38 width=8) (never executed)

  • Index Cond: (turmaorigem = 97,392)
127. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turma_1 (cost=0.29..2.42 rows=1 width=4) (never executed)

  • Index Cond: (codigo = turmaagrupada_1.turma)
  • Filter: ((tiposubturma)::text = 'PRATICA'::text)
128. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turmaorigem (cost=0.29..2.60 rows=1 width=4) (never executed)

  • Index Cond: (codigo = 97,392)
  • Filter: (NOT subturma)
129. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..130.72 rows=1 width=4) (never executed)

130. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.57..128.03 rows=1 width=8) (never executed)

131. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_2 (cost=0.29..33.79 rows=38 width=8) (never executed)

  • Index Cond: (turmaorigem = 97,392)
132. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turma_2 (cost=0.29..2.42 rows=1 width=4) (never executed)

  • Index Cond: (codigo = turmaagrupada_2.turma)
  • Filter: ((tiposubturma)::text = 'TEORICA'::text)
133. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turmaorigem_1 (cost=0.29..2.60 rows=1 width=4) (never executed)

  • Index Cond: (codigo = 97,392)
  • Filter: (NOT subturma)
134. 0.347 165.658 ↓ 21.7 65 1

Nested Loop (cost=3,481.83..30,014.47 rows=3 width=36) (actual time=120.158..165.658 rows=65 loops=1)

135. 0.418 164.661 ↓ 21.7 65 1

Nested Loop (cost=3,481.40..30,012.81 rows=3 width=22) (actual time=120.110..164.661 rows=65 loops=1)

  • Join Filter: (((curso_2.periodicidade)::text = 'IN'::text) OR (((curso_2.periodicidade)::text = ANY ('{AN,SE}'::text[])) AND (SubPlan 13)))
136. 0.511 151.763 ↓ 21.7 65 1

Nested Loop (cost=3,481.13..30,003.07 rows=3 width=46) (actual time=120.076..151.763 rows=65 loops=1)

  • Join Filter: (((matricula_2.gradecurricularatual = historico_2.matrizcurricular) AND ((historico_2.historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historico_2.historicocursandoporcorrespondenciaapostransferencia)) AND ((historico_2.transferenciamatrizcurricularmatricula IS NULL) OR ((historico_2.transferenciamatrizcurricularmatricula IS NOT NULL) AND (NOT (SubPlan 20))))) OR ((matricula_2.gradecurricularatual <> historico_2.matrizcurricular) AND historico_2.historicocursandoporcorrespondenciaapostransferencia AND (historico_2.transferenciamatrizcurricularmatricula IS NOT NULL) AND (historico_2.disciplina = (SubPlan 21)) AND ((NOT historico_2.historicoporequivalencia) OR (historico_2.historicoporequivalencia IS NULL))) OR ((matricula_2.gradecurricularatual <> historico_2.matrizcurricular) AND historico_2.historicoequivalente AND (SubPlan 22)) OR ((historico_2.matrizcurricular = matriculaperiodo_2.gradecurricular) AND (matricula_2.gradecurricularatual <> historico_2.matrizcurricular) AND historico_2.historicodisciplinafazpartecomposicao AND (NOT (SubPlan 23))))
137. 0.463 150.147 ↑ 5.1 65 1

Nested Loop (cost=3,480.71..6,177.87 rows=332 width=68) (actual time=120.025..150.147 rows=65 loops=1)

138. 79.486 148.815 ↑ 6.0 79 1

Hash Join (cost=3,480.29..5,922.56 rows=475 width=64) (actual time=119.975..148.815 rows=79 loops=1)

  • Hash Cond: (turma_6.codigo = matriculaperiodoturmadisciplina_2.turma)
  • Join Filter: ((turma_6.codigo = 97,392) OR (hashed SubPlan 14) OR (hashed SubPlan 15) OR (hashed SubPlan 16))
  • Rows Removed by Join Filter: 272
139. 39.569 39.569 ↑ 1.0 18,425 1

Seq Scan on turma turma_6 (cost=0.00..2,267.50 rows=18,425 width=24) (actual time=0.017..39.569 rows=18,425 loops=1)

140. 0.946 28.158 ↑ 1.5 351 1

Hash (cost=3,129.40..3,129.40 rows=542 width=76) (actual time=28.157..28.158 rows=351 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 50kB
141. 13.487 27.212 ↑ 1.5 351 1

Merge Join (cost=2,270.97..3,129.40 rows=542 width=76) (actual time=13.242..27.212 rows=351 loops=1)

  • Merge Cond: (matriculaperiodoturmadisciplina_2.disciplina = disciplina_2.codigo)
142. 1.457 10.654 ↑ 1.8 351 1

Sort (cost=2,263.14..2,264.69 rows=620 width=80) (actual time=10.158..10.654 rows=351 loops=1)

  • Sort Key: matriculaperiodoturmadisciplina_2.disciplina
  • Sort Method: quicksort Memory: 74kB
143. 2.081 9.197 ↑ 1.8 351 1

Nested Loop (cost=0.86..2,234.38 rows=620 width=80) (actual time=0.212..9.197 rows=351 loops=1)

144. 2.553 2.553 ↑ 1.8 351 1

Index Scan using ch_historico_disciplina on historico historico_2 (cost=0.43..555.83 rows=620 width=48) (actual time=0.175..2.553 rows=351 loops=1)

  • Index Cond: (disciplina = 7,459)
  • Filter: ((situacao)::text <> ALL ('{AA,CC,CH,IS}'::text[]))
145. 4.563 4.563 ↑ 1.0 1 351

Index Scan using matriculaperiodoturmadisciplina_pkey on matriculaperiodoturmadisciplina matriculaperiodoturmadisciplina_2 (cost=0.43..2.71 rows=1 width=40) (actual time=0.013..0.013 rows=1 loops=351)

  • Index Cond: (codigo = historico_2.matriculaperiodoturmadisciplina)
146. 2.984 3.071 ↑ 5,843.0 1 1

Index Only Scan using disciplina_pkey on disciplina disciplina_2 (cost=7.55..798.62 rows=5,843 width=4) (actual time=3.070..3.071 rows=1 loops=1)

  • Filter: ((codigo = 7,459) OR (hashed SubPlan 17) OR (hashed SubPlan 18) OR (hashed SubPlan 19))
  • Rows Removed by Filter: 6,068
  • Heap Fetches: 0
147.          

SubPlan (for Index Only Scan)

148. 0.032 0.032 ↑ 1.0 1 1

Index Scan using idx_turmadisciplina_turma_disciplina on turmadisciplina turmadisciplina_1 (cost=0.42..2.73 rows=1 width=4) (actual time=0.028..0.032 rows=1 loops=1)

  • Index Cond: ((turma = 97,392) AND (disciplina = 7,459))
149. 0.022 0.022 ↓ 0.0 0 1

Index Only Scan using disciplinaequivalente_pkey on disciplinaequivalente disciplinaequivalente_2 (cost=0.14..1.35 rows=1 width=4) (actual time=0.020..0.022 rows=0 loops=1)

  • Index Cond: (disciplina = 7,459)
  • Heap Fetches: 0
150. 0.033 0.033 ↓ 0.0 0 1

Index Only Scan using disciplinaequivalente_pkey on disciplinaequivalente disciplinaequivalente_3 (cost=0.14..3.19 rows=1 width=4) (actual time=0.032..0.033 rows=0 loops=1)

  • Index Cond: (equivalente = 7,459)
  • Heap Fetches: 0
151.          

SubPlan (for Hash Join)

152. 0.136 0.136 ↓ 1.3 50 1

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_3 (cost=0.29..33.79 rows=38 width=4) (actual time=0.022..0.136 rows=50 loops=1)

  • Index Cond: (turmaorigem = 97,392)
153. 0.002 0.739 ↓ 0.0 0 1

Nested Loop (cost=0.86..130.72 rows=1 width=4) (actual time=0.738..0.739 rows=0 loops=1)

154. 0.254 0.737 ↓ 0.0 0 1

Nested Loop (cost=0.57..128.03 rows=1 width=8) (actual time=0.736..0.737 rows=0 loops=1)

155. 0.133 0.133 ↓ 1.3 50 1

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_4 (cost=0.29..33.79 rows=38 width=8) (actual time=0.021..0.133 rows=50 loops=1)

  • Index Cond: (turmaorigem = 97,392)
156. 0.350 0.350 ↓ 0.0 0 50

Index Scan using turma_pkey on turma turma_4 (cost=0.29..2.42 rows=1 width=4) (actual time=0.007..0.007 rows=0 loops=50)

  • Index Cond: (codigo = turmaagrupada_4.turma)
  • Filter: ((tiposubturma)::text = 'PRATICA'::text)
  • Rows Removed by Filter: 1
157. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turmaorigem_2 (cost=0.29..2.60 rows=1 width=4) (never executed)

  • Index Cond: (codigo = 97,392)
  • Filter: (NOT subturma)
158. 0.004 0.727 ↓ 0.0 0 1

Nested Loop (cost=0.86..130.72 rows=1 width=4) (actual time=0.725..0.727 rows=0 loops=1)

159. 0.239 0.723 ↓ 0.0 0 1

Nested Loop (cost=0.57..128.03 rows=1 width=8) (actual time=0.722..0.723 rows=0 loops=1)

160. 0.134 0.134 ↓ 1.3 50 1

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_5 (cost=0.29..33.79 rows=38 width=8) (actual time=0.023..0.134 rows=50 loops=1)

  • Index Cond: (turmaorigem = 97,392)
161. 0.350 0.350 ↓ 0.0 0 50

Index Scan using turma_pkey on turma turma_5 (cost=0.29..2.42 rows=1 width=4) (actual time=0.007..0.007 rows=0 loops=50)

  • Index Cond: (codigo = turmaagrupada_5.turma)
  • Filter: ((tiposubturma)::text = 'TEORICA'::text)
  • Rows Removed by Filter: 1
162. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turmaorigem_3 (cost=0.29..2.60 rows=1 width=4) (never executed)

  • Index Cond: (codigo = 97,392)
  • Filter: (NOT subturma)
163. 0.869 0.869 ↑ 1.0 1 79

Index Scan using matriculaperiodo_pkey on matriculaperiodo matriculaperiodo_2 (cost=0.42..0.54 rows=1 width=8) (actual time=0.011..0.011 rows=1 loops=79)

  • Index Cond: (codigo = matriculaperiodoturmadisciplina_2.matriculaperiodo)
  • Filter: (((situacaomatriculaperiodo)::text = ANY ('{AT,FO,FI}'::text[])) AND ((situacao)::text = ANY ('{PF,CO,AT}'::text[])))
  • Rows Removed by Filter: 0
164. 1.105 1.105 ↑ 1.0 1 65

Index Scan using matricula_pkey on matricula matricula_2 (cost=0.42..0.53 rows=1 width=26) (actual time=0.017..0.017 rows=1 loops=65)

  • Index Cond: ((matricula)::text = (matriculaperiodoturmadisciplina_2.matricula)::text)
165.          

SubPlan (for Nested Loop)

166. 0.000 0.000 ↓ 0.0 0

Limit (cost=13.17..14.38 rows=1 width=4) (never executed)

167. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_4 (cost=13.17..14.38 rows=1 width=4) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_2.matricula)::text) AND (disciplina = historico_2.disciplina))
  • Filter: (historicocursandoporcorrespondenciaapostransferencia AND (matrizcurricular <> matricula_2.gradecurricularatual) AND ((anohistorico)::text = (historico_2.anohistorico)::text) AND ((semestrehistorico)::text = (historico_2.semestrehistorico)::text) AND (transferenciamatrizcurricularmatricula = historico_2.transferenciamatrizcurricularmatricula))
168. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

169. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_2.matricula)::text)
170. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = historico_2.disciplina)
171. 0.000 0.000 ↓ 0.0 0

Limit (cost=13.17..14.38 rows=1 width=4) (never executed)

172. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_5 (cost=13.17..14.38 rows=1 width=4) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_2.matricula)::text) AND (disciplina = historico_2.disciplina))
  • Filter: (((historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historicocursandoporcorrespondenciaapostransferencia)) AND ((anohistorico)::text = (historico_2.anohistorico)::text) AND ((semestrehistorico)::text = (historico_2.semestrehistorico)::text) AND (transferenciamatrizcurricularmatricula = historico_2.transferenciamatrizcurricularmatricula) AND (matrizcurricular = matricula_2.gradecurricularatual))
173. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

174. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_2.matricula)::text)
175. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = historico_2.disciplina)
176. 0.000 0.000 ↓ 0.0 0

Nested Loop Semi Join (cost=13.60..41.80 rows=1 width=0) (never executed)

177. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_historico_matricula on historico hist_1 (cost=0.43..27.32 rows=1 width=24) (never executed)

  • Index Cond: ((matricula)::text = (historico_2.matricula)::text)
  • Filter: (historicoporequivalencia AND (historico_2.mapaequivalenciadisciplina = mapaequivalenciadisciplina) AND (numeroagrupamentoequivalenciadisciplina = historico_2.numeroagrupamentoequivalenciadisciplina))
178. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_6 (cost=13.17..14.38 rows=1 width=24) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_2.matricula)::text) AND (disciplina = hist_1.disciplina))
  • Filter: (((historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historicocursandoporcorrespondenciaapostransferencia)) AND (matrizcurricular = matricula_2.gradecurricularatual) AND ((hist_1.anohistorico)::text = (anohistorico)::text) AND ((hist_1.semestrehistorico)::text = (semestrehistorico)::text) AND (hist_1.transferenciamatrizcurricularmatricula = transferenciamatrizcurricularmatricula))
179. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

180. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_2.matricula)::text)
181. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = hist_1.disciplina)
182. 0.000 0.000 ↓ 0.0 0

Index Only Scan using unq_historico_disciplina_matrper_matrperturm_grade_gd_gcgod on historico his_7 (cost=0.56..1.77 rows=1 width=4) (never executed)

  • Index Cond: ((disciplina = historico_2.disciplina) AND (matriculaperiodo = historico_2.matriculaperiodo) AND (matrizcurricular = matricula_2.gradecurricularatual))
  • Heap Fetches: 0
183. 12.480 12.480 ↑ 1.0 1 65

Index Scan using curso_pkey on curso curso_2 (cost=0.28..0.38 rows=1 width=7) (actual time=0.192..0.192 rows=1 loops=65)

  • Index Cond: (codigo = matricula_2.curso)
184.          

SubPlan (for Nested Loop)

185. 0.000 0.000 ↓ 0.0 0

Limit (cost=2.75..2.76 rows=1 width=40) (never executed)

186. 0.000 0.000 ↓ 0.0 0

Sort (cost=2.75..2.76 rows=1 width=40) (never executed)

  • Sort Key: ((((mp_1.ano)::text || '/'::text) || (mp_1.semestre)::text)) DESC, (CASE WHEN ((mp_1.situacaomatriculaperiodo)::text = ANY ('{AT,PR,FI,FO}'::text[])) THEN 1 ELSE 2 END), mp_1.codigo DESC
187. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_matriculaperiodo_matricula_ano_semestre on matriculaperiodo mp_1 (cost=0.42..2.74 rows=1 width=40) (never executed)

  • Index Cond: (((matricula)::text = (matricula_2.matricula)::text) AND ((ano)::text = (matriculaperiodoturmadisciplina_2.ano)::text) AND ((semestre)::text = (matriculaperiodoturmadisciplina_2.semestre)::text))
188. 0.650 0.650 ↑ 1.0 1 65

Index Only Scan using pessoa_pkey on pessoa pessoa_2 (cost=0.42..0.55 rows=1 width=4) (actual time=0.010..0.010 rows=1 loops=65)

  • Index Cond: (codigo = matricula_2.aluno)
  • Heap Fetches: 10
189. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=315.52..405.67 rows=1 width=0) (never executed)

190. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=315.10..402.94 rows=1 width=4) (never executed)

191. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=307.55..394.52 rows=1 width=8) (never executed)

192. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=11.92..96.58 rows=1 width=20) (never executed)

  • Join Filter: ((((curso_3.periodicidade)::text = 'IN'::text) OR (((curso_3.periodicidade)::text = ANY ('{AN,SE}'::text[])) AND (SubPlan 25))) AND (((matricula_3.gradecurricularatual = historico_3.matrizcurricular) AND ((historico_3.historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historico_3.historicocursandoporcorrespondenciaapostransferencia)) AND ((historico_3.transferenciamatrizcurricularmatricula IS NULL) OR ((historico_3.transferenciamatrizcurricularmatricula IS NOT NULL) AND (NOT (SubPlan 32))))) OR ((matricula_3.gradecurricularatual <> historico_3.matrizcurricular) AND historico_3.historicocursandoporcorrespondenciaapostransferencia AND (historico_3.transferenciamatrizcurricularmatricula IS NOT NULL) AND (historico_3.disciplina = (SubPlan 33)) AND ((NOT historico_3.historicoporequivalencia) OR (historico_3.historicoporequivalencia IS NULL))) OR ((matricula_3.gradecurricularatual <> historico_3.matrizcurricular) AND historico_3.historicoequivalente AND (SubPlan 34)) OR ((historico_3.matrizcurricular = matriculaperiodo_3.gradecurricular) AND (matricula_3.gradecurricularatual <> historico_3.matrizcurricular) AND historico_3.historicodisciplinafazpartecomposicao AND (NOT (SubPlan 35)))))
193. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.70..5.32 rows=1 width=25) (never executed)

194. 0.000 0.000 ↓ 0.0 0

Index Scan using matricula_pkey on matricula matricula_3 (cost=0.42..2.73 rows=1 width=26) (never executed)

  • Index Cond: ((matricula)::text = (t."MatriculaPeriodoTurmaDisciplina.matricula")::text)
195. 0.000 0.000 ↓ 0.0 0

Index Scan using curso_pkey on curso curso_3 (cost=0.28..2.58 rows=1 width=7) (never executed)

  • Index Cond: (codigo = matricula_3.curso)
196. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=11.23..17.26 rows=1 width=84) (never executed)

197. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=10.81..14.53 rows=1 width=80) (never executed)

198. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico historico_3 (cost=10.38..11.59 rows=1 width=48) (never executed)

  • Recheck Cond: (((matricula)::text = (t."MatriculaPeriodoTurmaDisciplina.matricula")::text) AND (disciplina = 7,459))
  • Filter: ((situacao)::text <> ALL ('{AA,CC,CH,IS}'::text[]))
199. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=10.38..10.38 rows=1 width=0) (never executed)

200. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (t."MatriculaPeriodoTurmaDisciplina.matricula")::text)
201. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..8.43 rows=627 width=0) (never executed)

  • Index Cond: (disciplina = 7,459)
202. 0.000 0.000 ↓ 0.0 0

Index Scan using matriculaperiodoturmadisciplina_pkey on matriculaperiodoturmadisciplina matriculaperiodoturmadisciplina_3 (cost=0.43..2.74 rows=1 width=40) (never executed)

  • Index Cond: (codigo = historico_3.matriculaperiodoturmadisciplina)
  • Filter: ((matricula)::text = (t."MatriculaPeriodoTurmaDisciplina.matricula")::text)
203. 0.000 0.000 ↓ 0.0 0

Index Scan using matriculaperiodo_pkey on matriculaperiodo matriculaperiodo_3 (cost=0.42..2.74 rows=1 width=8) (never executed)

  • Index Cond: (codigo = matriculaperiodoturmadisciplina_3.matriculaperiodo)
  • Filter: (((situacaomatriculaperiodo)::text = ANY ('{AT,FO,FI}'::text[])) AND ((situacao)::text = ANY ('{PF,CO,AT}'::text[])))
204.          

SubPlan (for Nested Loop)

205. 0.000 0.000 ↓ 0.0 0

Limit (cost=2.75..2.76 rows=1 width=40) (never executed)

206. 0.000 0.000 ↓ 0.0 0

Sort (cost=2.75..2.76 rows=1 width=40) (never executed)

  • Sort Key: ((((mp_2.ano)::text || '/'::text) || (mp_2.semestre)::text)) DESC, (CASE WHEN ((mp_2.situacaomatriculaperiodo)::text = ANY ('{AT,PR,FI,FO}'::text[])) THEN 1 ELSE 2 END), mp_2.codigo DESC
207. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_matriculaperiodo_matricula_ano_semestre on matriculaperiodo mp_2 (cost=0.42..2.74 rows=1 width=40) (never executed)

  • Index Cond: (((matricula)::text = (matricula_3.matricula)::text) AND ((ano)::text = (matriculaperiodoturmadisciplina_3.ano)::text) AND ((semestre)::text = (matriculaperiodoturmadisciplina_3.semestre)::text))
208. 0.000 0.000 ↓ 0.0 0

Limit (cost=13.17..14.38 rows=1 width=4) (never executed)

209. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_8 (cost=13.17..14.38 rows=1 width=4) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_3.matricula)::text) AND (disciplina = historico_3.disciplina))
  • Filter: (historicocursandoporcorrespondenciaapostransferencia AND (matrizcurricular <> matricula_3.gradecurricularatual) AND ((anohistorico)::text = (historico_3.anohistorico)::text) AND ((semestrehistorico)::text = (historico_3.semestrehistorico)::text) AND (transferenciamatrizcurricularmatricula = historico_3.transferenciamatrizcurricularmatricula))
210. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

211. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_3.matricula)::text)
212. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = historico_3.disciplina)
213. 0.000 0.000 ↓ 0.0 0

Limit (cost=13.17..14.38 rows=1 width=4) (never executed)

214. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_9 (cost=13.17..14.38 rows=1 width=4) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_3.matricula)::text) AND (disciplina = historico_3.disciplina))
  • Filter: (((historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historicocursandoporcorrespondenciaapostransferencia)) AND ((anohistorico)::text = (historico_3.anohistorico)::text) AND ((semestrehistorico)::text = (historico_3.semestrehistorico)::text) AND (transferenciamatrizcurricularmatricula = historico_3.transferenciamatrizcurricularmatricula) AND (matrizcurricular = matricula_3.gradecurricularatual))
215. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

216. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_3.matricula)::text)
217. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = historico_3.disciplina)
218. 0.000 0.000 ↓ 0.0 0

Nested Loop Semi Join (cost=13.60..41.80 rows=1 width=0) (never executed)

219. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_historico_matricula on historico hist_2 (cost=0.43..27.32 rows=1 width=24) (never executed)

  • Index Cond: ((matricula)::text = (historico_3.matricula)::text)
  • Filter: (historicoporequivalencia AND (historico_3.mapaequivalenciadisciplina = mapaequivalenciadisciplina) AND (numeroagrupamentoequivalenciadisciplina = historico_3.numeroagrupamentoequivalenciadisciplina))
220. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_10 (cost=13.17..14.38 rows=1 width=24) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_3.matricula)::text) AND (disciplina = hist_2.disciplina))
  • Filter: (((historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historicocursandoporcorrespondenciaapostransferencia)) AND (matrizcurricular = matricula_3.gradecurricularatual) AND ((hist_2.anohistorico)::text = (anohistorico)::text) AND ((hist_2.semestrehistorico)::text = (semestrehistorico)::text) AND (hist_2.transferenciamatrizcurricularmatricula = transferenciamatrizcurricularmatricula))
221. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

222. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_3.matricula)::text)
223. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = hist_2.disciplina)
224. 0.000 0.000 ↓ 0.0 0

Index Only Scan using unq_historico_disciplina_matrper_matrperturm_grade_gd_gcgod on historico his_11 (cost=0.56..1.77 rows=1 width=4) (never executed)

  • Index Cond: ((disciplina = historico_3.disciplina) AND (matriculaperiodo = historico_3.matriculaperiodo) AND (matrizcurricular = matricula_3.gradecurricularatual))
  • Heap Fetches: 0
225. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turma_9 (cost=295.62..297.84 rows=1 width=24) (never executed)

  • Index Cond: (codigo = matriculaperiodoturmadisciplina_3.turma)
  • Filter: ((codigo = 97,392) OR (hashed SubPlan 26) OR (hashed SubPlan 27) OR (hashed SubPlan 28))
226.          

SubPlan (for Index Scan)

227. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_6 (cost=0.29..33.79 rows=38 width=4) (never executed)

  • Index Cond: (turmaorigem = 97,392)
228. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..130.72 rows=1 width=4) (never executed)

229. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.57..128.03 rows=1 width=8) (never executed)

230. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_7 (cost=0.29..33.79 rows=38 width=8) (never executed)

  • Index Cond: (turmaorigem = 97,392)
231. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turma_7 (cost=0.29..2.42 rows=1 width=4) (never executed)

  • Index Cond: (codigo = turmaagrupada_7.turma)
  • Filter: ((tiposubturma)::text = 'PRATICA'::text)
232. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turmaorigem_4 (cost=0.29..2.60 rows=1 width=4) (never executed)

  • Index Cond: (codigo = 97,392)
  • Filter: (NOT subturma)
233. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..130.72 rows=1 width=4) (never executed)

234. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.57..128.03 rows=1 width=8) (never executed)

235. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_8 (cost=0.29..33.79 rows=38 width=8) (never executed)

  • Index Cond: (turmaorigem = 97,392)
236. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turma_8 (cost=0.29..2.42 rows=1 width=4) (never executed)

  • Index Cond: (codigo = turmaagrupada_8.turma)
  • Filter: ((tiposubturma)::text = 'TEORICA'::text)
237. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turmaorigem_5 (cost=0.29..2.60 rows=1 width=4) (never executed)

  • Index Cond: (codigo = 97,392)
  • Filter: (NOT subturma)
238. 0.000 0.000 ↓ 0.0 0

Index Only Scan using disciplina_pkey on disciplina disciplina_3 (cost=7.55..8.42 rows=1 width=4) (never executed)

  • Index Cond: (codigo = matriculaperiodoturmadisciplina_3.disciplina)
  • Filter: ((codigo = 7,459) OR (hashed SubPlan 29) OR (hashed SubPlan 30) OR (hashed SubPlan 31))
  • Heap Fetches: 0
239.          

SubPlan (for Index Only Scan)

240. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmadisciplina_turma_disciplina on turmadisciplina turmadisciplina_2 (cost=0.42..2.73 rows=1 width=4) (never executed)

  • Index Cond: ((turma = 97,392) AND (disciplina = 7,459))
241. 0.000 0.000 ↓ 0.0 0

Index Only Scan using disciplinaequivalente_pkey on disciplinaequivalente disciplinaequivalente_4 (cost=0.14..1.35 rows=1 width=4) (never executed)

  • Index Cond: (disciplina = 7,459)
  • Heap Fetches: 0
242. 0.000 0.000 ↓ 0.0 0

Index Only Scan using disciplinaequivalente_pkey on disciplinaequivalente disciplinaequivalente_5 (cost=0.14..3.19 rows=1 width=4) (never executed)

  • Index Cond: (equivalente = 7,459)
  • Heap Fetches: 0
243. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pessoa_pkey on pessoa pessoa_3 (cost=0.42..2.73 rows=1 width=4) (never executed)

  • Index Cond: (codigo = matricula_3.aluno)
  • Heap Fetches: 0
244. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=305.58..2,677.45 rows=1 width=32) (never executed)

245. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=305.15..2,676.89 rows=1 width=18) (never executed)

246. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=297.60..2,669.22 rows=1 width=22) (never executed)

247. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.98..2,373.38 rows=1 width=34) (never executed)

  • Join Filter: ((((curso_4.periodicidade)::text = 'IN'::text) OR (((curso_4.periodicidade)::text = ANY ('{AN,SE}'::text[])) AND (SubPlan 37))) AND (((matricula_4.gradecurricularatual = historico_4.matrizcurricular) AND ((historico_4.historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historico_4.historicocursandoporcorrespondenciaapostransferencia)) AND ((historico_4.transferenciamatrizcurricularmatricula IS NULL) OR ((historico_4.transferenciamatrizcurricularmatricula IS NOT NULL) AND (NOT (SubPlan 44))))) OR ((matricula_4.gradecurricularatual <> historico_4.matrizcurricular) AND historico_4.historicocursandoporcorrespondenciaapostransferencia AND (historico_4.transferenciamatrizcurricularmatricula IS NOT NULL) AND (historico_4.disciplina = (SubPlan 45)) AND ((NOT historico_4.historicoporequivalencia) OR (historico_4.historicoporequivalencia IS NULL))) OR ((matricula_4.gradecurricularatual <> historico_4.matrizcurricular) AND historico_4.historicoequivalente AND (SubPlan 46)) OR ((historico_4.matrizcurricular = matriculaperiodo_4.gradecurricular) AND (matricula_4.gradecurricularatual <> historico_4.matrizcurricular) AND historico_4.historicodisciplinafazpartecomposicao AND (NOT (SubPlan 47)))))
248. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.56..2,298.85 rows=1 width=91) (never executed)

249. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.28..2,298.46 rows=1 width=92) (never executed)

250. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..2,297.93 rows=1 width=80) (never executed)

251. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_historico_disciplina on historico historico_4 (cost=0.43..555.83 rows=620 width=48) (never executed)

  • Index Cond: (disciplina = 7,459)
  • Filter: ((situacao)::text <> ALL ('{AA,CC,CH,IS}'::text[]))
252. 0.000 0.000 ↓ 0.0 0

Index Scan using matriculaperiodoturmadisciplina_pkey on matriculaperiodoturmadisciplina matriculaperiodoturmadisciplina_4 (cost=0.43..2.71 rows=1 width=40) (never executed)

  • Index Cond: (codigo = historico_4.matriculaperiodoturmadisciplina)
  • Filter: ((historico_4.matricula)::text = (matricula)::text)
253. 0.000 0.000 ↓ 0.0 0

Index Scan using matricula_pkey on matricula matricula_4 (cost=0.42..0.53 rows=1 width=26) (never executed)

  • Index Cond: ((matricula)::text = (matriculaperiodoturmadisciplina_4.matricula)::text)
254. 0.000 0.000 ↓ 0.0 0

Index Scan using curso_pkey on curso curso_4 (cost=0.28..0.38 rows=1 width=7) (never executed)

  • Index Cond: (codigo = matricula_4.curso)
255. 0.000 0.000 ↓ 0.0 0

Index Scan using matriculaperiodo_pkey on matriculaperiodo matriculaperiodo_4 (cost=0.42..0.54 rows=1 width=8) (never executed)

  • Index Cond: (codigo = matriculaperiodoturmadisciplina_4.matriculaperiodo)
  • Filter: (((situacaomatriculaperiodo)::text = ANY ('{AT,FO,FI}'::text[])) AND ((situacao)::text = ANY ('{PF,CO,AT}'::text[])))
256.          

SubPlan (for Nested Loop)

257. 0.000 0.000 ↓ 0.0 0

Limit (cost=2.75..2.76 rows=1 width=40) (never executed)

258. 0.000 0.000 ↓ 0.0 0

Sort (cost=2.75..2.76 rows=1 width=40) (never executed)

  • Sort Key: ((((mp_3.ano)::text || '/'::text) || (mp_3.semestre)::text)) DESC, (CASE WHEN ((mp_3.situacaomatriculaperiodo)::text = ANY ('{AT,PR,FI,FO}'::text[])) THEN 1 ELSE 2 END), mp_3.codigo DESC
259. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_matriculaperiodo_matricula_ano_semestre on matriculaperiodo mp_3 (cost=0.42..2.74 rows=1 width=40) (never executed)

  • Index Cond: (((matricula)::text = (matricula_4.matricula)::text) AND ((ano)::text = (matriculaperiodoturmadisciplina_4.ano)::text) AND ((semestre)::text = (matriculaperiodoturmadisciplina_4.semestre)::text))
260. 0.000 0.000 ↓ 0.0 0

Limit (cost=13.17..14.38 rows=1 width=4) (never executed)

261. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_12 (cost=13.17..14.38 rows=1 width=4) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_4.matricula)::text) AND (disciplina = historico_4.disciplina))
  • Filter: (historicocursandoporcorrespondenciaapostransferencia AND (matrizcurricular <> matricula_4.gradecurricularatual) AND ((anohistorico)::text = (historico_4.anohistorico)::text) AND ((semestrehistorico)::text = (historico_4.semestrehistorico)::text) AND (transferenciamatrizcurricularmatricula = historico_4.transferenciamatrizcurricularmatricula))
262. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

263. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_4.matricula)::text)
264. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = historico_4.disciplina)
265. 0.000 0.000 ↓ 0.0 0

Limit (cost=13.17..14.38 rows=1 width=4) (never executed)

266. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_13 (cost=13.17..14.38 rows=1 width=4) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_4.matricula)::text) AND (disciplina = historico_4.disciplina))
  • Filter: (((historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historicocursandoporcorrespondenciaapostransferencia)) AND ((anohistorico)::text = (historico_4.anohistorico)::text) AND ((semestrehistorico)::text = (historico_4.semestrehistorico)::text) AND (transferenciamatrizcurricularmatricula = historico_4.transferenciamatrizcurricularmatricula) AND (matrizcurricular = matricula_4.gradecurricularatual))
267. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

268. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_4.matricula)::text)
269. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = historico_4.disciplina)
270. 0.000 0.000 ↓ 0.0 0

Nested Loop Semi Join (cost=13.60..41.80 rows=1 width=0) (never executed)

271. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_historico_matricula on historico hist_3 (cost=0.43..27.32 rows=1 width=24) (never executed)

  • Index Cond: ((matricula)::text = (historico_4.matricula)::text)
  • Filter: (historicoporequivalencia AND (historico_4.mapaequivalenciadisciplina = mapaequivalenciadisciplina) AND (numeroagrupamentoequivalenciadisciplina = historico_4.numeroagrupamentoequivalenciadisciplina))
272. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_14 (cost=13.17..14.38 rows=1 width=24) (never executed)

  • Recheck Cond: (((matricula)::text = (historico_4.matricula)::text) AND (disciplina = hist_3.disciplina))
  • Filter: (((historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT historicocursandoporcorrespondenciaapostransferencia)) AND (matrizcurricular = matricula_4.gradecurricularatual) AND ((hist_3.anohistorico)::text = (anohistorico)::text) AND ((hist_3.semestrehistorico)::text = (semestrehistorico)::text) AND (hist_3.transferenciamatrizcurricularmatricula = transferenciamatrizcurricularmatricula))
273. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=13.17..13.17 rows=1 width=0) (never executed)

274. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_historico_matricula_gradedisciplina (cost=0.00..1.70 rows=22 width=0) (never executed)

  • Index Cond: ((matricula)::text = (historico_4.matricula)::text)
275. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_historico_disciplina (cost=0.00..11.22 rows=852 width=0) (never executed)

  • Index Cond: (disciplina = hist_3.disciplina)
276. 0.000 0.000 ↓ 0.0 0

Index Only Scan using unq_historico_disciplina_matrper_matrperturm_grade_gd_gcgod on historico his_15 (cost=0.56..1.77 rows=1 width=4) (never executed)

  • Index Cond: ((disciplina = historico_4.disciplina) AND (matriculaperiodo = historico_4.matriculaperiodo) AND (matrizcurricular = matricula_4.gradecurricularatual))
  • Heap Fetches: 0
277. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turma_12 (cost=295.62..295.74 rows=1 width=24) (never executed)

  • Index Cond: (codigo = matriculaperiodoturmadisciplina_4.turma)
  • Filter: ((codigo = 97,392) OR (hashed SubPlan 38) OR (hashed SubPlan 39) OR (hashed SubPlan 40))
278.          

SubPlan (for Index Scan)

279. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_9 (cost=0.29..33.79 rows=38 width=4) (never executed)

  • Index Cond: (turmaorigem = 97,392)
280. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..130.72 rows=1 width=4) (never executed)

281. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.57..128.03 rows=1 width=8) (never executed)

282. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_10 (cost=0.29..33.79 rows=38 width=8) (never executed)

  • Index Cond: (turmaorigem = 97,392)
283. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turma_10 (cost=0.29..2.42 rows=1 width=4) (never executed)

  • Index Cond: (codigo = turmaagrupada_10.turma)
  • Filter: ((tiposubturma)::text = 'PRATICA'::text)
284. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turmaorigem_6 (cost=0.29..2.60 rows=1 width=4) (never executed)

  • Index Cond: (codigo = 97,392)
  • Filter: (NOT subturma)
285. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..130.72 rows=1 width=4) (never executed)

286. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.57..128.03 rows=1 width=8) (never executed)

287. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmaagrupada_turmaorigem on turmaagrupada turmaagrupada_11 (cost=0.29..33.79 rows=38 width=8) (never executed)

  • Index Cond: (turmaorigem = 97,392)
288. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turma_11 (cost=0.29..2.42 rows=1 width=4) (never executed)

  • Index Cond: (codigo = turmaagrupada_11.turma)
  • Filter: ((tiposubturma)::text = 'TEORICA'::text)
289. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turmaorigem_7 (cost=0.29..2.60 rows=1 width=4) (never executed)

  • Index Cond: (codigo = 97,392)
  • Filter: (NOT subturma)
290. 0.000 0.000 ↓ 0.0 0

Index Only Scan using disciplina_pkey on disciplina disciplina_4 (cost=7.55..7.67 rows=1 width=4) (never executed)

  • Index Cond: (codigo = matriculaperiodoturmadisciplina_4.disciplina)
  • Filter: ((codigo = 7,459) OR (hashed SubPlan 41) OR (hashed SubPlan 42) OR (hashed SubPlan 43))
  • Heap Fetches: 0
291.          

SubPlan (for Index Only Scan)

292. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmadisciplina_turma_disciplina on turmadisciplina turmadisciplina_3 (cost=0.42..2.73 rows=1 width=4) (never executed)

  • Index Cond: ((turma = 97,392) AND (disciplina = 7,459))
293. 0.000 0.000 ↓ 0.0 0

Index Only Scan using disciplinaequivalente_pkey on disciplinaequivalente disciplinaequivalente_6 (cost=0.14..1.35 rows=1 width=4) (never executed)

  • Index Cond: (disciplina = 7,459)
  • Heap Fetches: 0
294. 0.000 0.000 ↓ 0.0 0

Index Only Scan using disciplinaequivalente_pkey on disciplinaequivalente disciplinaequivalente_7 (cost=0.14..3.19 rows=1 width=4) (never executed)

  • Index Cond: (equivalente = 7,459)
  • Heap Fetches: 0
295. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pessoa_pkey on pessoa pessoa_4 (cost=0.42..0.55 rows=1 width=4) (never executed)

  • Index Cond: (codigo = matricula_4.aluno)
  • Heap Fetches: 0
Planning time : 168.369 ms
Execution time : 11,814.258 ms