explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3LrB

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 38,643.129 ↓ 0.0 0 1

Unique (cost=98,321,145.72..98,327,174.82 rows=301,455 width=234) (actual time=38,643.129..38,643.129 rows=0 loops=1)

2. 0.008 38,643.128 ↓ 0.0 0 1

Sort (cost=98,321,145.72..98,321,899.35 rows=301,455 width=234) (actual time=38,643.128..38,643.128 rows=0 loops=1)

  • Sort Key: ((unidadeensino.nome)::text), ((turma.identificadorturma)::text), turma.codigo, (array_to_string(array_agg(DISTINCT CASE WHEN (gradedisciplinacomposta.disciplina IS NOT NULL) THEN gradedisciplinacomposta.disciplina ELSE CASE WHEN (gdcgd.disciplina IS NOT NULL) THEN gdcgd.disciplina ELSE CASE WHEN (gdcgo.disciplina IS NOT NULL) THEN gdcgo.disciplina ELSE CASE WHEN (gradedisciplina.disciplina IS NOT NULL) THEN gradedisciplina.disciplina ELSE CASE WHEN (gradecurriculargrupooptativadisciplina.disciplina IS NOT NULL) THEN gradecurriculargrupooptativadisciplina.disciplina ELSE 5730 END END END END END), ','::text)), (((CASE WHEN (vagaturmadisciplina.nrvagasmatriculareposicao IS NOT NULL) THEN vagaturmadisciplina.nrvagasmatriculareposicao ELSE turma.nrvagasinclusaoreposicao END - ((SubPlan 4) + (SubPlan 6))))::integer), curso.nome, (COALESCE(concat(cidade.nome, estado.sigla), ''::text))
  • Sort Method: quicksort Memory: 25kB
3. 0.002 38,643.120 ↓ 0.0 0 1

GroupAggregate (cost=10,302,312.26..98,259,708.43 rows=301,455 width=234) (actual time=38,643.120..38,643.120 rows=0 loops=1)

  • Group Key: turma.codigo, unidadeensino.nome, vagaturmadisciplina.nrvagasmatriculareposicao, curso.nome, cidade.nome, estado.sigla
4. 0.008 38,643.118 ↓ 0.0 0 1

Sort (cost=10,302,312.26..10,303,065.90 rows=301,455 width=126) (actual time=38,643.118..38,643.118 rows=0 loops=1)

  • Sort Key: turma.codigo, unidadeensino.nome, vagaturmadisciplina.nrvagasmatriculareposicao, curso.nome, cidade.nome, estado.sigla
  • Sort Method: quicksort Memory: 25kB
5. 3.503 38,643.110 ↓ 0.0 0 1

Nested Loop (cost=23,951.03..10,274,877.47 rows=301,455 width=126) (actual time=38,643.110..38,643.110 rows=0 loops=1)

6. 10.712 1,481.949 ↓ 1.5 933 1

Hash Left Join (cost=8,114.33..621,284.18 rows=609 width=132) (actual time=220.740..1,481.949 rows=933 loops=1)

  • Hash Cond: (vagaturma.codigo = vagaturmadisciplina.vagaturma)
  • Filter: ((((vagaturmadisciplina.codigo IS NOT NULL) AND (vagaturmadisciplina.nrvagasmatriculareposicao IS NOT NULL) AND (vagaturmadisciplina.nrvagasmatriculareposicao > 0)) OR ((vagaturmadisciplina.codigo IS NULL) AND (turma.nrvagasinclusaoreposicao IS NOT NULL) AND (turma.nrvagasinclusaoreposicao > 0))) AND (((SubPlan 14) + (SubPlan 16)) < CASE WHEN (vagaturmadisciplina.nrvagasmatriculareposicao IS NOT NULL) THEN vagaturmadisciplina.nrvagasmatriculareposicao ELSE turma.nrvagasinclusaoreposicao END))
  • Rows Removed by Filter: 3
7. 3.209 384.002 ↑ 2.0 936 1

Nested Loop Left Join (cost=7,395.88..620,560.93 rows=1,827 width=132) (actual time=218.125..384.002 rows=936 loops=1)

8. 9.034 371.433 ↑ 2.0 936 1

Nested Loop Left Join (cost=7,395.60..619,920.17 rows=1,827 width=128) (actual time=218.059..371.433 rows=936 loops=1)

  • Join Filter: (unidadeensino.codigo = turma.unidadeensino)
  • Rows Removed by Join Filter: 73,008
9. 35.074 354.911 ↑ 2.0 936 1

Hash Left Join (cost=7,383.02..617,459.32 rows=1,827 width=91) (actual time=217.887..354.911 rows=936 loops=1)

  • Hash Cond: (gradecurriculargrupooptativadisciplina.codigo = gdcgo.gradecurriculargrupooptativadisciplina)
  • Join Filter: (NOT (alternatives: SubPlan 9 or hashed SubPlan 10))
  • Filter: (((turmadisciplina.disciplina = 5,730) AND (gradedisciplina.cargahoraria = 24)) OR ((turmadisciplina.disciplina = 5,730) AND (gradecurriculargrupooptativadisciplina.cargahoraria = 24)) OR ((gdcgd.disciplina = 5,730) AND (gdcgd.cargahoraria = 24)) OR ((gdcgo.disciplina = 5,730) AND (gdcgo.cargahoraria = 24)) OR ((gradedisciplinacomposta.disciplina = 5,730) AND (gradedisciplinacomposta.cargahoraria = 24)))
  • Rows Removed by Filter: 98,115
10. 24.249 319.832 ↑ 1.0 99,051 1

Hash Left Join (cost=7,365.82..18,097.02 rows=100,101 width=115) (actual time=216.380..319.832 rows=99,051 loops=1)

  • Hash Cond: (turmadisciplina.gradecurriculargrupooptativadisciplina = gradecurriculargrupooptativadisciplina.codigo)
11. 34.701 295.557 ↑ 1.0 99,051 1

Hash Join (cost=7,364.28..17,832.72 rows=100,101 width=107) (actual time=216.335..295.557 rows=99,051 loops=1)

  • Hash Cond: (turma.curso = curso.codigo)
12. 44.960 260.578 ↑ 1.0 99,051 1

Hash Right Join (cost=7,330.69..17,534.23 rows=100,101 width=64) (actual time=216.046..260.578 rows=99,051 loops=1)

  • Hash Cond: (gdcgd.gradedisciplina = gradedisciplina.codigo)
  • Join Filter: (NOT (alternatives: SubPlan 7 or hashed SubPlan 8))
13. 0.024 0.024 ↓ 0.0 0 1

Seq Scan on gradedisciplinacomposta gdcgd (cost=0.00..13.20 rows=320 width=12) (actual time=0.024..0.024 rows=0 loops=1)

14. 32.369 215.594 ↑ 1.0 99,051 1

Hash (cost=6,079.43..6,079.43 rows=100,101 width=60) (actual time=215.594..215.594 rows=99,051 loops=1)

  • Buckets: 131,072 Batches: 1 Memory Usage: 9,832kB
15. 34.412 183.225 ↑ 1.0 99,051 1

Hash Left Join (cost=5,762.70..6,079.43 rows=100,101 width=60) (actual time=115.639..183.225 rows=99,051 loops=1)

  • Hash Cond: (turmadisciplina.gradedisciplina = gradedisciplina.codigo)
16. 33.812 144.954 ↑ 1.0 99,051 1

Hash Right Join (cost=5,301.54..5,355.41 rows=100,101 width=52) (actual time=111.720..144.954 rows=99,051 loops=1)

  • Hash Cond: (turmadisciplinacomposta.turmadisciplina = turmadisciplina.codigo)
17. 0.001 0.021 ↓ 0.0 0 1

Hash Left Join (cost=17.20..50.62 rows=1,850 width=12) (actual time=0.020..0.021 rows=0 loops=1)

  • Hash Cond: (turmadisciplinacomposta.gradedisciplinacomposta = gradedisciplinacomposta.codigo)
18. 0.020 0.020 ↓ 0.0 0 1

Seq Scan on turmadisciplinacomposta (cost=0.00..28.50 rows=1,850 width=8) (actual time=0.020..0.020 rows=0 loops=1)

19. 0.000 0.000 ↓ 0.0 0

Hash (cost=13.20..13.20 rows=320 width=12) (never executed)

20. 0.000 0.000 ↓ 0.0 0

Seq Scan on gradedisciplinacomposta (cost=0.00..13.20 rows=320 width=12) (never executed)

21. 31.948 111.121 ↑ 1.0 99,051 1

Hash (cost=4,033.08..4,033.08 rows=100,101 width=44) (actual time=111.121..111.121 rows=99,051 loops=1)

  • Buckets: 131,072 Batches: 1 Memory Usage: 9,058kB
22. 39.973 79.173 ↑ 1.0 99,051 1

Hash Join (cost=462.20..4,033.08 rows=100,101 width=44) (actual time=6.965..79.173 rows=99,051 loops=1)

  • Hash Cond: (turmadisciplina.turma = turma.codigo)
23. 32.293 32.293 ↑ 1.0 136,640 1

Seq Scan on turmadisciplina (cost=0.00..3,212.02 rows=136,650 width=20) (actual time=0.015..32.293 rows=136,640 loops=1)

  • Filter: permitereposicao
  • Rows Removed by Filter: 462
24. 1.587 6.907 ↑ 1.0 7,445 1

Hash (cost=368.88..368.88 rows=7,466 width=28) (actual time=6.907..6.907 rows=7,445 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 525kB
25. 5.320 5.320 ↑ 1.0 7,445 1

Seq Scan on turma (cost=0.00..368.88 rows=7,466 width=28) (actual time=0.009..5.320 rows=7,445 loops=1)

  • Filter: ((((NOT subturma) AND (NOT turmaagrupada)) OR (subturma AND ((tiposubturma)::text = 'GERAL'::text))) AND ((situacao)::text = 'AB'::text))
  • Rows Removed by Filter: 2,747
26. 1.724 3.859 ↑ 1.0 11,607 1

Hash (cost=316.07..316.07 rows=11,607 width=12) (actual time=3.859..3.859 rows=11,607 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 627kB
27. 2.135 2.135 ↑ 1.0 11,607 1

Seq Scan on gradedisciplina (cost=0.00..316.07 rows=11,607 width=12) (actual time=0.007..2.135 rows=11,607 loops=1)

28.          

SubPlan (for Hash Right Join)

29. 0.000 0.000 ↓ 0.0 0

Seq Scan on turmadisciplinacomposta turmadisciplinacomposta_1 (cost=0.00..33.13 rows=9 width=0) (never executed)

  • Filter: (turmadisciplina = turmadisciplina.codigo)
30. 0.000 0.000 ↓ 0.0 0

Seq Scan on turmadisciplinacomposta turmadisciplinacomposta_2 (cost=0.00..28.50 rows=1,850 width=4) (never executed)

31. 0.108 0.278 ↑ 1.0 515 1

Hash (cost=27.15..27.15 rows=515 width=51) (actual time=0.278..0.278 rows=515 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 51kB
32. 0.170 0.170 ↑ 1.0 515 1

Seq Scan on curso (cost=0.00..27.15 rows=515 width=51) (actual time=0.014..0.170 rows=515 loops=1)

33. 0.005 0.026 ↑ 1.0 24 1

Hash (cost=1.24..1.24 rows=24 width=12) (actual time=0.026..0.026 rows=24 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
34. 0.021 0.021 ↑ 1.0 24 1

Seq Scan on gradecurriculargrupooptativadisciplina (cost=0.00..1.24 rows=24 width=12) (actual time=0.017..0.021 rows=24 loops=1)

35. 0.001 0.005 ↓ 0.0 0 1

Hash (cost=13.20..13.20 rows=320 width=12) (actual time=0.005..0.005 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
36. 0.004 0.004 ↓ 0.0 0 1

Seq Scan on gradedisciplinacomposta gdcgo (cost=0.00..13.20 rows=320 width=12) (actual time=0.004..0.004 rows=0 loops=1)

37.          

SubPlan (for Hash Left Join)

38. 0.000 0.000 ↓ 0.0 0

Seq Scan on turmadisciplinacomposta turmadisciplinacomposta_3 (cost=0.00..33.13 rows=9 width=0) (never executed)

  • Filter: (turmadisciplina = turmadisciplina.codigo)
39. 0.000 0.000 ↓ 0.0 0

Seq Scan on turmadisciplinacomposta turmadisciplinacomposta_4 (cost=0.00..28.50 rows=1,850 width=4) (never executed)

40. 5.496 7.488 ↑ 1.0 79 936

Materialize (cost=12.58..296.05 rows=79 width=45) (actual time=0.000..0.008 rows=79 loops=936)

41. 0.045 1.992 ↑ 1.0 79 1

Hash Left Join (cost=12.58..295.66 rows=79 width=45) (actual time=0.158..1.992 rows=79 loops=1)

  • Hash Cond: (cidade.estado = estado.codigo)
42. 0.062 1.921 ↑ 1.0 79 1

Nested Loop Left Join (cost=10.56..293.41 rows=79 width=47) (actual time=0.118..1.921 rows=79 loops=1)

  • Join Filter: (unidadeensino.configuracoes = configuracoes.codigo)
43. 0.448 1.859 ↑ 1.0 79 1

Merge Right Join (cost=10.56..290.19 rows=79 width=47) (actual time=0.094..1.859 rows=79 loops=1)

  • Merge Cond: (cidade.codigo = unidadeensino.cidade)
44. 1.325 1.325 ↑ 1.9 5,614 1

Index Scan using cidade_pkey on cidade (cost=0.29..499.35 rows=10,636 width=27) (actual time=0.016..1.325 rows=5,614 loops=1)

45. 0.041 0.086 ↑ 1.0 79 1

Sort (cost=10.28..10.48 rows=79 width=28) (actual time=0.074..0.086 rows=79 loops=1)

  • Sort Key: unidadeensino.cidade
  • Sort Method: quicksort Memory: 31kB
46. 0.045 0.045 ↑ 1.0 79 1

Seq Scan on unidadeensino (cost=0.00..7.79 rows=79 width=28) (actual time=0.010..0.045 rows=79 loops=1)

47. 0.000 0.000 ↑ 1.0 1 79

Materialize (cost=0.00..2.04 rows=1 width=8) (actual time=0.000..0.000 rows=1 loops=79)

48. 0.005 0.017 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.00..2.03 rows=1 width=8) (actual time=0.016..0.017 rows=1 loops=1)

  • Join Filter: (configuracaogeralsistema.configuracoes = configuracoes.codigo)
49. 0.007 0.007 ↑ 1.0 1 1

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

50. 0.005 0.005 ↑ 1.0 1 1

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

51. 0.011 0.026 ↑ 1.0 45 1

Hash (cost=1.45..1.45 rows=45 width=6) (actual time=0.026..0.026 rows=45 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
52. 0.015 0.015 ↑ 1.0 45 1

Seq Scan on estado (cost=0.00..1.45 rows=45 width=6) (actual time=0.008..0.015 rows=45 loops=1)

53. 9.360 9.360 ↑ 1.0 1 936

Index Scan using ch_vagaturma_turma on vagaturma (cost=0.28..0.34 rows=1 width=10) (actual time=0.009..0.010 rows=1 loops=936)

  • Index Cond: (turma = turma.codigo)
  • Filter: ((turma.semestral AND ((ano)::text = ''::text) AND ((semestre)::text = ''::text)) OR (turma.anual AND ((ano)::text = ''::text)) OR ((NOT turma.semestral) AND (NOT turma.anual)))
54. 0.367 0.993 ↑ 1.0 2,573 1

Hash (cost=685.61..685.61 rows=2,627 width=12) (actual time=0.993..0.993 rows=2,573 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 143kB
55. 0.517 0.626 ↑ 1.0 2,573 1

Bitmap Heap Scan on vagaturmadisciplina (cost=52.78..685.61 rows=2,627 width=12) (actual time=0.123..0.626 rows=2,573 loops=1)

  • Recheck Cond: (disciplina = 5,730)
  • Heap Blocks: exact=103
56. 0.109 0.109 ↑ 1.0 2,573 1

Bitmap Index Scan on ch_vagaturmadisciplina_disciplina (cost=0.00..52.12 rows=2,627 width=0) (actual time=0.109..0.109 rows=2,573 loops=1)

  • Index Cond: (disciplina = 5,730)
57.          

SubPlan (for Hash Left Join)

58. 18.680 170.922 ↑ 1.0 1 934

Aggregate (cost=159.69..159.70 rows=1 width=8) (actual time=0.183..0.183 rows=1 loops=934)

59. 3.475 152.242 ↑ 1.0 1 934

Nested Loop (cost=2.40..159.69 rows=1 width=4) (actual time=0.107..0.163 rows=1 loops=934)

  • Join Filter: (((m_1.gradecurricularatual = h_1.matrizcurricular) AND ((h_1.historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT h_1.historicocursandoporcorrespondenciaapostransferencia)) AND ((h_1.transferenciamatrizcurricularmatricula IS NULL) OR ((h_1.transferenciamatrizcurricularmatricula IS NOT NULL) AND (NOT (SubPlan 11))))) OR ((m_1.gradecurricularatual <> h_1.matrizcurricular) AND h_1.historicocursandoporcorrespondenciaapostransferencia AND (h_1.transferenciamatrizcurricularmatricula IS NOT NULL) AND (h_1.disciplina = (SubPlan 12))) OR ((h_1.matrizcurricular = mp_2.gradecurricular) AND (m_1.gradecurricularatual <> h_1.matrizcurricular) AND h_1.historicodisciplinafazpartecomposicao AND (NOT (SubPlan 13))))
60. 3.967 141.034 ↑ 1.0 1 934

Nested Loop (cost=1.97..94.68 rows=1 width=16) (actual time=0.102..0.151 rows=1 loops=934)

  • Join Filter: (conf_1.codigo = confg_1.configuracoes)
61. 8.637 136.364 ↑ 1.0 1 934

Nested Loop (cost=1.97..93.66 rows=1 width=24) (actual time=0.100..0.146 rows=1 loops=934)

  • Join Filter: (ue_1.configuracoes = conf_1.codigo)
62. 1.396 127.024 ↑ 1.0 1 934

Nested Loop (cost=1.97..92.64 rows=1 width=20) (actual time=0.094..0.136 rows=1 loops=934)

63. 2.561 124.222 ↑ 1.0 1 934

Nested Loop (cost=1.83..92.48 rows=1 width=20) (actual time=0.092..0.133 rows=1 loops=934)

64. 1.858 119.552 ↑ 1.0 1 934

Nested Loop (cost=1.54..88.16 rows=1 width=24) (actual time=0.089..0.128 rows=1 loops=934)

  • Join Filter: CASE WHEN ((c_1.periodicidade)::text = ANY ('{SE,IN}'::text[])) THEN (((mp_2.ano)::text = ''::text) AND ((mp_2.semestre)::text = ''::text)) WHEN ((c_1.periodicidade)::text = 'AN'::text) THEN ((mp_2.ano)::text = ''::text) ELSE ((c_1.periodicidade)::text = 'IN'::text) END
65. 3.422 114.882 ↑ 1.0 1 934

Nested Loop (cost=1.27..87.85 rows=1 width=30) (actual time=0.086..0.123 rows=1 loops=934)

66. 2.847 95.268 ↑ 1.0 1 934

Nested Loop (cost=0.85..87.19 rows=1 width=32) (actual time=0.078..0.102 rows=1 loops=934)

67. 84.060 84.060 ↑ 1.0 1 934

Index Scan using matriculaperiodoturmadisciplina_turma_disciplina_matricula on matriculaperiodoturmadisciplina mptd_1 (cost=0.43..78.75 rows=1 width=12) (actual time=0.071..0.090 rows=1 loops=934)

  • Index Cond: ((turma = turma.codigo) AND (disciplina = 5,730))
  • Filter: reposicao
  • Rows Removed by Filter: 44
68. 8.361 8.361 ↑ 1.0 1 929

Index Scan using matriculaperiodo_pkey on matriculaperiodo mp_2 (cost=0.42..8.44 rows=1 width=24) (actual time=0.009..0.009 rows=1 loops=929)

  • Index Cond: (codigo = mptd_1.matriculaperiodo)
  • Filter: ((situacaomatriculaperiodo)::text = ANY ('{AT,PR,CO}'::text[]))
  • Rows Removed by Filter: 0
69. 16.192 16.192 ↑ 1.0 1 704

Index Scan using matricula_pkey on matricula m_1 (cost=0.42..0.65 rows=1 width=26) (actual time=0.023..0.023 rows=1 loops=704)

  • Index Cond: ((matricula)::text = (mp_2.matricula)::text)
  • Filter: ((situacao)::text = 'AT'::text)
  • Rows Removed by Filter: 0
70. 2.812 2.812 ↑ 1.0 1 703

Index Scan using curso_pkey on curso c_1 (cost=0.28..0.29 rows=1 width=7) (actual time=0.004..0.004 rows=1 loops=703)

  • Index Cond: (codigo = m_1.curso)
71. 2.109 2.109 ↑ 1.0 1 703

Index Only Scan using turma_pkey on turma t_6 (cost=0.29..4.30 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=703)

  • Index Cond: (codigo = turma.codigo)
  • Heap Fetches: 0
72. 1.406 1.406 ↑ 1.0 1 703

Index Scan using unidadeensino_pkey on unidadeensino ue_1 (cost=0.14..0.16 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=703)

  • Index Cond: (codigo = m_1.unidadeensino)
73. 0.703 0.703 ↑ 1.0 1 703

Seq Scan on configuracoes conf_1 (cost=0.00..1.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=703)

74. 0.703 0.703 ↑ 1.0 1 703

Seq Scan on configuracaogeralsistema confg_1 (cost=0.00..1.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=703)

75. 7.733 7.733 ↑ 1.0 1 703

Index Scan using index_historico_matriculaperiodoturmadisciplina on historico h_1 (cost=0.43..8.45 rows=1 width=38) (actual time=0.011..0.011 rows=1 loops=703)

  • Index Cond: (matriculaperiodoturmadisciplina = mptd_1.codigo)
76.          

SubPlan (for Nested Loop)

77. 0.000 0.000 ↓ 0.0 0

Limit (cost=24.03..28.05 rows=1 width=4) (never executed)

78. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on historico his_3 (cost=24.03..28.05 rows=1 width=4) (never executed)

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

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

80. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: ((matricula)::text = (h_1.matricula)::text)
81. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (disciplina = h_1.disciplina)
82. 0.000 0.000 ↓ 0.0 0

Limit (cost=24.03..28.05 rows=1 width=4) (never executed)

83. 0.000 0.000 ↓ 0.0 0

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

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

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

85. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: ((matricula)::text = (h_1.matricula)::text)
86. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (disciplina = h_1.disciplina)
87. 0.000 0.000 ↓ 0.0 0

Index Only Scan using unq_historico_disciplina_matrper_matrperturm_grade_gd_gcgod on historico his_5 (cost=0.43..4.45 rows=1 width=4) (never executed)

  • Index Cond: ((disciplina = h_1.disciplina) AND (matriculaperiodo = h_1.matriculaperiodo) AND (matrizcurricular = m_1.gradecurricularatual))
  • Heap Fetches: 0
88. 1.868 915.320 ↑ 1.0 1 934

Aggregate (cost=132.02..132.03 rows=1 width=8) (actual time=0.980..0.980 rows=1 loops=934)

89. 0.874 913.452 ↓ 0.0 0 934

Nested Loop Left Join (cost=33.56..132.02 rows=1 width=4) (actual time=0.978..0.978 rows=0 loops=934)

  • Join Filter: requerimento_1.disciplinaporequivalencia
  • Filter: ((requerimento_1.disciplina = 5,730) OR (mapaequivalenciadisciplinacursada_1.disciplina = 5,730))
  • Rows Removed by Filter: 0
90. 1.388 912.518 ↓ 0.0 0 934

Nested Loop Left Join (cost=33.28..123.70 rows=1 width=13) (actual time=0.975..0.977 rows=0 loops=934)

  • Filter: (((requerimento_1.situacaofinanceira)::text = 'IS'::text) OR (contareceber_1.codigo IS NULL) OR (contareceber_1.datavencimento <= CURRENT_DATE))
91. 0.788 910.650 ↓ 0.0 0 934

Nested Loop (cost=32.85..115.24 rows=1 width=20) (actual time=0.973..0.975 rows=0 loops=934)

  • Join Filter: (((turmareposicao_1.semestral AND ((matper_1.ano)::text = ''::text) AND ((matper_1.semestre)::text = ''::text)) OR (turmareposicao_1.anual AND ((matper_1.ano)::text = ''::text)) OR ((NOT turmareposicao_1.anual) AND (NOT turmareposicao_1.semestral))) AND CASE WHEN (requerimento_1.matriculaperiodo IS NOT NULL) THEN (requerimento_1.matriculaperiodo = matper_1.codigo) ELSE CASE WHEN (requerimento_1.codigo <> 0) THEN (matper_1.turma = requerimento_1.turma) ELSE (matper_1.codigo = (SubPlan 15)) END END)
92. 1.542 908.782 ↓ 0.0 0 934

Nested Loop (cost=32.43..106.13 rows=1 width=58) (actual time=0.971..0.973 rows=0 loops=934)

93. 17.386 905.980 ↓ 0.0 0 934

Nested Loop (cost=32.01..97.69 rows=1 width=44) (actual time=0.969..0.970 rows=0 loops=934)

94. 14.010 888.234 ↓ 0.0 0 934

Nested Loop (cost=31.73..89.38 rows=1 width=46) (actual time=0.950..0.951 rows=0 loops=934)

95. 48.568 48.568 ↑ 1.0 2 934

Seq Scan on tiporequerimento tiporequerimento_1 (cost=0.00..17.88 rows=2 width=4) (actual time=0.005..0.052 rows=2 loops=934)

  • Filter: ((tipo)::text = 'RE'::text)
  • Rows Removed by Filter: 148
96. 29.888 825.656 ↓ 0.0 0 1,868

Bitmap Heap Scan on requerimento requerimento_1 (cost=31.73..35.74 rows=1 width=50) (actual time=0.442..0.442 rows=0 loops=1,868)

  • Recheck Cond: ((turmareposicao = turma.codigo) AND (tiporequerimento = tiporequerimento_1.codigo))
  • Filter: ((situacao)::text <> ALL ('{FD,FI}'::text[]))
  • Rows Removed by Filter: 6
  • Heap Blocks: exact=10,620
97. 4.626 795.768 ↓ 0.0 0 1,868

BitmapAnd (cost=31.73..31.73 rows=1 width=0) (actual time=0.426..0.426 rows=0 loops=1,868)

98. 13.076 13.076 ↑ 2.0 12 1,868

Bitmap Index Scan on idx_requerimento_turmareposicao (cost=0.00..4.60 rows=24 width=0) (actual time=0.007..0.007 rows=12 loops=1,868)

  • Index Cond: (turmareposicao = turma.codigo)
99. 778.066 778.066 ↓ 7.3 10,237 1,126

Bitmap Index Scan on ch_requerimento_tiporequerimento (cost=0.00..26.88 rows=1,394 width=0) (actual time=0.691..0.691 rows=10,237 loops=1,126)

  • Index Cond: (tiporequerimento = tiporequerimento_1.codigo)
100. 0.360 0.360 ↑ 1.0 1 60

Index Scan using turma_pkey on turma turmareposicao_1 (cost=0.29..8.30 rows=1 width=6) (actual time=0.006..0.006 rows=1 loops=60)

  • Index Cond: (codigo = turma.codigo)
101. 1.260 1.260 ↑ 1.0 1 60

Index Scan using matricula_pkey on matricula mat_1 (cost=0.42..8.44 rows=1 width=14) (actual time=0.021..0.021 rows=1 loops=60)

  • Index Cond: ((matricula)::text = (requerimento_1.matricula)::text)
  • Filter: ((situacao)::text = 'AT'::text)
102. 1.080 1.080 ↑ 1.0 1 60

Index Scan using ch_matriculaperiodo_matricula on matriculaperiodo matper_1 (cost=0.42..0.62 rows=1 width=24) (actual time=0.018..0.018 rows=1 loops=60)

  • Index Cond: ((matricula)::text = (mat_1.matricula)::text)
  • Filter: ((situacaomatriculaperiodo)::text = ANY ('{AT,PR}'::text[]))
103.          

SubPlan (for Nested Loop)

104. 0.000 0.000 ↓ 0.0 0

Limit (cost=8.45..8.46 rows=1 width=40) (never executed)

105. 0.000 0.000 ↓ 0.0 0

Sort (cost=8.45..8.46 rows=1 width=40) (never executed)

  • Sort Key: ((((mp_3.ano)::text || '/'::text) || (mp_3.semestre)::text)) DESC, mp_3.periodoletivomatricula DESC
106. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: ((matricula)::text = (requerimento_1.matricula)::text)
107. 0.480 0.480 ↑ 1.0 1 60

Index Scan using contareceber_pkey on contareceber contareceber_1 (cost=0.43..8.45 rows=1 width=12) (actual time=0.008..0.008 rows=1 loops=60)

  • Index Cond: (codigo = requerimento_1.contareceber)
108. 0.060 0.060 ↓ 0.0 0 60

Index Scan using pk_mapaequivalenciadisciplinacursada_codigo on mapaequivalenciadisciplinacursada mapaequivalenciadisciplinacursada_1 (cost=0.28..8.30 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=60)

  • Index Cond: (codigo = requerimento_1.mapaequivalenciadisciplinacursada)
109. 6.531 37,157.658 ↓ 0.0 0 933

HashAggregate (cost=15,836.70..15,841.65 rows=495 width=4) (actual time=39.826..39.826 rows=0 loops=933)

  • Group Key: ht.turma
110. 25.191 37,151.127 ↓ 0.0 0 933

Append (cost=1.12..15,835.46 rows=495 width=4) (actual time=39.819..39.819 rows=0 loops=933)

111. 1.077 105.429 ↓ 0.0 0 933

Nested Loop (cost=1.12..61.26 rows=1 width=4) (actual time=0.113..0.113 rows=0 loops=933)

112. 1.890 98.898 ↑ 16.0 1 933

Nested Loop (cost=0.70..48.77 rows=16 width=8) (actual time=0.099..0.106 rows=1 loops=933)

113. 7.464 7.464 ↑ 1.0 1 933

Index Scan using ch_horarioturma_turma_ano_semestre on horarioturma ht (cost=0.28..8.30 rows=1 width=8) (actual time=0.007..0.008 rows=1 loops=933)

  • Index Cond: (turma = turma.codigo)
  • Filter: ((turma.semestral AND ((anovigente)::text = ''::text) AND ((semestrevigente)::text = ''::text)) OR (turma.anual AND ((anovigente)::text = ''::text)) OR ((NOT turma.semestral) AND (NOT turma.anual)))
114. 89.544 89.544 ↑ 17.0 1 728

Index Scan using fk_horarioturmadia_horarioturma on horarioturmadia htd (cost=0.42..40.30 rows=17 width=8) (actual time=0.114..0.123 rows=1 loops=728)

  • Index Cond: (horarioturma = ht.codigo)
  • Filter: (data >= (CURRENT_DATE + (((CASE WHEN (configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao > 0) THEN configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao ELSE 0 END)::text || ' days'::text))::interval))
  • Rows Removed by Filter: 58
115. 5.454 5.454 ↓ 0.0 0 909

Index Scan using idx_horturdiaitem_horturmdia on horarioturmadiaitem htdi (cost=0.42..0.77 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=909)

  • Index Cond: (horarioturmadia = htd.codigo)
  • Filter: ((disciplina = 5,730) OR (gradedisciplinacomposta.disciplina = disciplina) OR (gdcgd.disciplina = disciplina) OR (gdcgo.disciplina = disciplina))
  • Rows Removed by Filter: 1
116. 0.933 5.598 ↓ 0.0 0 933

Nested Loop (cost=1.43..40.17 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=933)

117. 0.000 4.665 ↓ 0.0 0 933

Nested Loop (cost=1.01..27.68 rows=16 width=8) (actual time=0.005..0.005 rows=0 loops=933)

118. 0.933 4.665 ↓ 0.0 0 933

Nested Loop (cost=0.57..23.71 rows=1 width=8) (actual time=0.005..0.005 rows=0 loops=933)

119. 3.732 3.732 ↓ 0.0 0 933

Index Scan using idx_turma_turmaprincipal on turma t (cost=0.29..15.39 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=933)

  • Index Cond: (turmaprincipal = turma.codigo)
  • Filter: (subturma AND (NOT turmaagrupada) AND ((situacao)::text = 'AB'::text))
120. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_horarioturma_turma_ano_semestre on horarioturma ht_1 (cost=0.28..8.30 rows=1 width=8) (never executed)

  • Index Cond: (turma = t.codigo)
  • Filter: ((turma.semestral AND ((anovigente)::text = ''::text) AND ((semestrevigente)::text = ''::text)) OR (turma.anual AND ((anovigente)::text = ''::text)) OR ((NOT turma.semestral) AND (NOT turma.anual)))
121. 0.000 0.000 ↓ 0.0 0

Index Scan using unq_horarioturmadia_horarioturma_data on horarioturmadia htd_1 (cost=0.44..3.81 rows=17 width=8) (never executed)

  • Index Cond: ((horarioturma = ht_1.codigo) AND (data >= (CURRENT_DATE + (((CASE WHEN (configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao > 0) THEN configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao ELSE 0 END)::text || ' days'::text))::interval)))
122. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_horturdiaitem_horturmdia on horarioturmadiaitem htdi_1 (cost=0.42..0.77 rows=1 width=4) (never executed)

  • Index Cond: (horarioturmadia = htd_1.codigo)
  • Filter: ((disciplina = 5,730) OR (gradedisciplinacomposta.disciplina = disciplina) OR (gdcgd.disciplina = disciplina) OR (gdcgo.disciplina = disciplina))
123. 0.000 5.598 ↓ 0.0 0 933

Nested Loop (cost=1.71..33.41 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=933)

124. 0.933 5.598 ↓ 0.0 0 933

Nested Loop (cost=1.29..20.92 rows=16 width=8) (actual time=0.006..0.006 rows=0 loops=933)

125. 0.933 4.665 ↓ 0.0 0 933

Nested Loop (cost=0.85..16.94 rows=1 width=8) (actual time=0.005..0.005 rows=0 loops=933)

126. 0.933 3.732 ↓ 0.0 0 933

Nested Loop (cost=0.57..16.61 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=933)

127. 2.799 2.799 ↓ 0.0 0 933

Index Scan using idx_turmaagrupada_turma on turmaagrupada (cost=0.28..8.30 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=933)

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

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

  • Index Cond: (codigo = turmaagrupada.turmaorigem)
  • Filter: ((situacao)::text = 'AB'::text)
129. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_horarioturma_turma_ano_semestre on horarioturma ht_2 (cost=0.28..0.33 rows=1 width=8) (never executed)

  • Index Cond: (turma = t_1.codigo)
  • Filter: ((turma.semestral AND ((anovigente)::text = ''::text) AND ((semestrevigente)::text = ''::text)) OR (turma.anual AND ((anovigente)::text = ''::text)) OR ((NOT turma.semestral) AND (NOT turma.anual)))
130. 0.000 0.000 ↓ 0.0 0

Index Scan using unq_horarioturmadia_horarioturma_data on horarioturmadia htd_2 (cost=0.44..3.81 rows=17 width=8) (never executed)

  • Index Cond: ((horarioturma = ht_2.codigo) AND (data >= (CURRENT_DATE + (((CASE WHEN (configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao > 0) THEN configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao ELSE 0 END)::text || ' days'::text))::interval)))
131. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_horturdiaitem_horturmdia on horarioturmadiaitem htdi_2 (cost=0.42..0.77 rows=1 width=4) (never executed)

  • Index Cond: (horarioturmadia = htd_2.codigo)
  • Filter: ((disciplina = 5,730) OR (gradedisciplinacomposta.disciplina = disciplina) OR (gdcgd.disciplina = disciplina) OR (gdcgo.disciplina = disciplina))
132. 0.933 4.665 ↓ 0.0 0 933

Hash Join (cost=4.35..36.05 rows=1 width=4) (actual time=0.005..0.005 rows=0 loops=933)

  • Hash Cond: (htdi_3.disciplina = de.equivalente)
133. 0.933 3.732 ↓ 0.0 0 933

Nested Loop (cost=1.71..33.25 rows=24 width=8) (actual time=0.004..0.004 rows=0 loops=933)

134. 0.000 2.799 ↓ 0.0 0 933

Nested Loop (cost=1.29..20.92 rows=16 width=8) (actual time=0.003..0.003 rows=0 loops=933)

135. 0.933 2.799 ↓ 0.0 0 933

Nested Loop (cost=0.85..16.94 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=933)

136. 0.933 1.866 ↓ 0.0 0 933

Nested Loop (cost=0.57..16.61 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=933)

137. 0.933 0.933 ↓ 0.0 0 933

Index Scan using idx_turmaagrupada_turma on turmaagrupada turmaagrupada_1 (cost=0.28..8.30 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=933)

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

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

  • Index Cond: (codigo = turmaagrupada_1.turmaorigem)
  • Filter: ((situacao)::text = 'AB'::text)
139. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_horarioturma_turma_ano_semestre on horarioturma ht_3 (cost=0.28..0.33 rows=1 width=8) (never executed)

  • Index Cond: (turma = t_2.codigo)
  • Filter: ((turma.semestral AND ((anovigente)::text = ''::text) AND ((semestrevigente)::text = ''::text)) OR (turma.anual AND ((anovigente)::text = ''::text)) OR ((NOT turma.semestral) AND (NOT turma.anual)))
140. 0.000 0.000 ↓ 0.0 0

Index Scan using unq_horarioturmadia_horarioturma_data on horarioturmadia htd_3 (cost=0.44..3.81 rows=17 width=8) (never executed)

  • Index Cond: ((horarioturma = ht_3.codigo) AND (data >= (CURRENT_DATE + (((CASE WHEN (configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao > 0) THEN configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao ELSE 0 END)::text || ' days'::text))::interval)))
141. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_horturdiaitem_horturmdia on horarioturmadiaitem htdi_3 (cost=0.42..0.75 rows=2 width=8) (never executed)

  • Index Cond: (horarioturmadia = htd_3.codigo)
142. 0.000 0.000 ↓ 0.0 0

Hash (cost=2.58..2.58 rows=5 width=4) (never executed)

143. 0.000 0.000 ↓ 0.0 0

Seq Scan on disciplinaequivalente de (cost=0.00..2.58 rows=5 width=4) (never executed)

  • Filter: ((disciplina = 5,730) OR (gradedisciplinacomposta.disciplina = disciplina) OR (gdcgd.disciplina = disciplina) OR (gdcgo.disciplina = disciplina))
144. 0.933 5.598 ↓ 0.0 0 933

Nested Loop (cost=2.13..29.65 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=933)

145. 0.933 4.665 ↓ 0.0 0 933

Nested Loop (cost=1.99..29.30 rows=2 width=8) (actual time=0.005..0.005 rows=0 loops=933)

146. 0.933 3.732 ↓ 0.0 0 933

Nested Loop (cost=1.57..28.53 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=933)

147. 0.000 2.799 ↓ 0.0 0 933

Nested Loop (cost=1.13..24.55 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=933)

148. 0.933 2.799 ↓ 0.0 0 933

Nested Loop (cost=0.85..24.22 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=933)

149. 0.933 1.866 ↓ 0.0 0 933

Nested Loop (cost=0.57..23.71 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=933)

150. 0.933 0.933 ↓ 0.0 0 933

Index Scan using idx_turma_turmaprincipal on turma tsub (cost=0.29..15.40 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=933)

  • Index Cond: (turmaprincipal = turma.codigo)
  • Filter: (subturma AND ((tiposubturma)::text = ANY ('{PRATICA,TEORICA}'::text[])) AND ((situacao)::text = 'AB'::text))
151. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmaagrupada_turma on turmaagrupada turmaagrupada_2 (cost=0.28..8.30 rows=1 width=8) (never executed)

  • Index Cond: (turma = tsub.codigo)
152. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (codigo = turmaagrupada_2.turmaorigem)
  • Filter: ((situacao)::text = 'AB'::text)
153. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_horarioturma_turma_ano_semestre on horarioturma ht_4 (cost=0.28..0.33 rows=1 width=8) (never executed)

  • Index Cond: (turma = t_3.codigo)
  • Filter: ((turma.semestral AND ((anovigente)::text = ''::text) AND ((semestrevigente)::text = ''::text)) OR (turma.anual AND ((anovigente)::text = ''::text)) OR ((NOT turma.semestral) AND (NOT turma.anual)))
154. 0.000 0.000 ↓ 0.0 0

Index Scan using unq_horarioturmadia_horarioturma_data on horarioturmadia htd_4 (cost=0.44..3.81 rows=17 width=8) (never executed)

  • Index Cond: ((horarioturma = ht_4.codigo) AND (data >= (CURRENT_DATE + (((CASE WHEN (configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao > 0) THEN configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao ELSE 0 END)::text || ' days'::text))::interval)))
155. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_horturdiaitem_horturmdia on horarioturmadiaitem htdi_4 (cost=0.42..0.75 rows=2 width=8) (never executed)

  • Index Cond: (horarioturmadia = htd_4.codigo)
156. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: ((disciplina = 5,730) AND (equivalente = htdi_4.disciplina))
  • Heap Fetches: 0
157. 334.014 36,921.609 ↓ 0.0 0 933

Hash Join (cost=4,127.03..15,552.24 rows=489 width=4) (actual time=39.573..39.573 rows=0 loops=933)

  • Hash Cond: (htd_5.horarioturma = ht_5.codigo)
  • Join Filter: (SubPlan 17)
158. 20,675.793 30,510.033 ↓ 1.0 3,728 933

Hash Join (cost=3,472.42..7,201.83 rows=3,589 width=12) (actual time=0.555..32.701 rows=3,728 loops=933)

  • Hash Cond: (htd_5.codigo = htdi_5.horarioturmadia)
159. 9,831.954 9,831.954 ↑ 1.0 154,835 933

Seq Scan on horarioturmadia htd_5 (cost=0.00..2,919.35 rows=154,835 width=16) (actual time=0.002..10.538 rows=154,835 loops=933)

160. 0.440 2.286 ↓ 1.0 3,728 1

Hash (cost=3,427.55..3,427.55 rows=3,589 width=4) (actual time=2.286..2.286 rows=3,728 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 164kB
161. 1.606 1.846 ↓ 1.0 3,728 1

Bitmap Heap Scan on horarioturmadiaitem htdi_5 (cost=68.23..3,427.55 rows=3,589 width=4) (actual time=0.343..1.846 rows=3,728 loops=1)

  • Recheck Cond: (disciplina = 5,730)
  • Heap Blocks: exact=988
162. 0.240 0.240 ↓ 1.0 3,728 1

Bitmap Index Scan on idx_horturdiaitem_disciplina (cost=0.00..67.34 rows=3,589 width=0) (actual time=0.240..0.240 rows=3,728 loops=1)

  • Index Cond: (disciplina = 5,730)
163. 134.352 6,077.562 ↓ 1.0 911 933

Hash (cost=643.35..643.35 rows=901 width=12) (actual time=6.514..6.514 rows=911 loops=933)

  • Buckets: 1,024 Batches: 1 Memory Usage: 48kB
164. 614.847 5,943.210 ↓ 1.0 911 933

Hash Join (cost=542.25..643.35 rows=901 width=12) (actual time=5.402..6.370 rows=911 loops=933)

  • Hash Cond: (turmaagrupada_3.turmaorigem = t_4.codigo)
165. 294.828 294.828 ↑ 1.0 4,807 933

Seq Scan on turmaagrupada turmaagrupada_3 (cost=0.00..74.07 rows=4,807 width=8) (actual time=0.002..0.316 rows=4,807 loops=933)

166. 264.972 5,033.535 ↑ 1.1 1,671 933

Hash (cost=518.37..518.37 rows=1,910 width=12) (actual time=5.395..5.395 rows=1,671 loops=933)

  • Buckets: 2,048 Batches: 1 Memory Usage: 88kB
167. 1,803.489 4,768.563 ↑ 1.1 1,671 933

Hash Join (cost=118.07..518.37 rows=1,910 width=12) (actual time=1.497..5.111 rows=1,671 loops=933)

  • Hash Cond: (t_4.codigo = ht_5.turma)
168. 1,588.899 1,588.899 ↑ 1.0 7,561 933

Seq Scan on turma t_4 (cost=0.00..343.40 rows=7,561 width=4) (actual time=0.003..1.703 rows=7,561 loops=933)

  • Filter: ((situacao)::text = 'AB'::text)
  • Rows Removed by Filter: 2,631
169. 431.979 1,376.175 ↓ 1.3 3,308 933

Hash (cost=85.89..85.89 rows=2,574 width=8) (actual time=1.475..1.475 rows=3,308 loops=933)

  • Buckets: 4,096 Batches: 1 Memory Usage: 162kB
170. 944.196 944.196 ↓ 1.3 3,308 933

Seq Scan on horarioturma ht_5 (cost=0.00..85.89 rows=2,574 width=8) (actual time=0.004..1.012 rows=3,308 loops=933)

  • Filter: ((turma.semestral AND ((anovigente)::text = ''::text) AND ((semestrevigente)::text = ''::text)) OR (turma.anual AND ((anovigente)::text = ''::text)) OR ((NOT turma.semestral) AND (NOT turma.anual)))
171.          

SubPlan (for Hash Join)

172. 0.000 0.000 ↓ 0.0 0

Result (cost=0.29..15.40 rows=1 width=4) (never executed)

  • One-Time Filter: (htd_5.data >= (CURRENT_DATE + (((CASE WHEN ($65 > 0) THEN $65 ELSE 0 END)::text || ' days'::text))::interval))
173. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turma_turmaprincipal on turma tsub_1 (cost=0.29..15.40 rows=1 width=4) (never executed)

  • Index Cond: (turmaprincipal = $64)
  • Filter: (subturma AND ((tiposubturma)::text = ANY ('{PRATICA,TEORICA}'::text[])) AND ((situacao)::text = 'AB'::text))
174. 3.732 77.439 ↓ 0.0 0 933

Nested Loop (cost=0.70..75.26 rows=1 width=4) (actual time=0.083..0.083 rows=0 loops=933)

175. 73.707 73.707 ↓ 0.0 0 933

Index Scan using unique_programacaotutoriaonline on programacaotutoriaonline (cost=0.28..66.81 rows=1 width=8) (actual time=0.079..0.079 rows=0 loops=933)

  • Index Cond: ((turma = turma.codigo) AND (disciplina = 5,730))
  • Filter: ((definirperiodoaulaonline IS TRUE) AND ((turma.semestral AND ((ano)::text = ''::text) AND ((semestre)::text = ''::text)) OR (turma.anual AND ((ano)::text = ''::text)) OR ((NOT turma.semestral) AND (NOT turma.anual))) AND (datainicioaula >= (CURRENT_DATE + (((CASE WHEN (configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao > 0) THEN configuracaogeralsistema.qtddiasmaximoantecedenciaremarcaraulareposicao ELSE 0 END)::text || ' days'::text))::interval)))
  • Rows Removed by Filter: 1
176. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_turmadisciplina_turma_disciplina on turmadisciplina turmadisciplina_1 (cost=0.42..8.45 rows=1 width=8) (never executed)

  • Index Cond: ((turma = turma.codigo) AND (disciplina = 5,730))
  • Filter: (((modalidadedisciplina)::text = 'ON_LINE'::text) AND ((definicoestutoriaonline)::text = 'DINAMICA'::text))
177.          

SubPlan (for GroupAggregate)

178. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=159.69..159.70 rows=1 width=8) (never executed)

179. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.40..159.69 rows=1 width=4) (never executed)

  • Join Filter: (((m.gradecurricularatual = h.matrizcurricular) AND ((h.historicocursandoporcorrespondenciaapostransferencia IS NULL) OR (NOT h.historicocursandoporcorrespondenciaapostransferencia)) AND ((h.transferenciamatrizcurricularmatricula IS NULL) OR ((h.transferenciamatrizcurricularmatricula IS NOT NULL) AND (NOT (SubPlan 1))))) OR ((m.gradecurricularatual <> h.matrizcurricular) AND h.historicocursandoporcorrespondenciaapostransferencia AND (h.transferenciamatrizcurricularmatricula IS NOT NULL) AND (h.disciplina = (SubPlan 2))) OR ((h.matrizcurricular = mp.gradecurricular) AND (m.gradecurricularatual <> h.matrizcurricular) AND h.historicodisciplinafazpartecomposicao AND (NOT (SubPlan 3))))
180. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.97..94.68 rows=1 width=16) (never executed)

  • Join Filter: (conf.codigo = confg.configuracoes)
181. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.97..93.66 rows=1 width=24) (never executed)

  • Join Filter: (ue.configuracoes = conf.codigo)
182. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.97..92.64 rows=1 width=20) (never executed)

183. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.83..92.48 rows=1 width=20) (never executed)

184. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.54..88.16 rows=1 width=24) (never executed)

  • Join Filter: CASE WHEN ((c.periodicidade)::text = ANY ('{SE,IN}'::text[])) THEN (((mp.ano)::text = ''::text) AND ((mp.semestre)::text = ''::text)) WHEN ((c.periodicidade)::text = 'AN'::text) THEN ((mp.ano)::text = ''::text) ELSE ((c.periodicidade)::text = 'IN'::text) END
185. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.27..87.85 rows=1 width=30) (never executed)

186. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.85..87.19 rows=1 width=32) (never executed)

187. 0.000 0.000 ↓ 0.0 0

Index Scan using matriculaperiodoturmadisciplina_turma_disciplina_matricula on matriculaperiodoturmadisciplina mptd (cost=0.43..78.75 rows=1 width=12) (never executed)

  • Index Cond: ((turma = turma.codigo) AND (disciplina = 5,730))
  • Filter: reposicao
188. 0.000 0.000 ↓ 0.0 0

Index Scan using matriculaperiodo_pkey on matriculaperiodo mp (cost=0.42..8.44 rows=1 width=24) (never executed)

  • Index Cond: (codigo = mptd.matriculaperiodo)
  • Filter: ((situacaomatriculaperiodo)::text = ANY ('{AT,PR,CO}'::text[]))
189. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: ((matricula)::text = (mp.matricula)::text)
  • Filter: ((situacao)::text = 'AT'::text)
190. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (codigo = m.curso)
191. 0.000 0.000 ↓ 0.0 0

Index Only Scan using turma_pkey on turma t_5 (cost=0.29..4.30 rows=1 width=4) (never executed)

  • Index Cond: (codigo = turma.codigo)
  • Heap Fetches: 0
192. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (codigo = m.unidadeensino)
193. 0.000 0.000 ↓ 0.0 0

Seq Scan on configuracoes conf (cost=0.00..1.01 rows=1 width=4) (never executed)

194. 0.000 0.000 ↓ 0.0 0

Seq Scan on configuracaogeralsistema confg (cost=0.00..1.01 rows=1 width=4) (never executed)

195. 0.000 0.000 ↓ 0.0 0

Index Scan using index_historico_matriculaperiodoturmadisciplina on historico h (cost=0.43..8.45 rows=1 width=38) (never executed)

  • Index Cond: (matriculaperiodoturmadisciplina = mptd.codigo)
196.          

SubPlan (for Nested Loop)

197. 0.000 0.000 ↓ 0.0 0

Limit (cost=24.03..28.05 rows=1 width=4) (never executed)

198. 0.000 0.000 ↓ 0.0 0

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

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

BitmapAnd (cost=24.03..24.03 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..4.59 rows=21 width=0) (never executed)

  • Index Cond: ((matricula)::text = (h.matricula)::text)
201. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (disciplina = h.disciplina)
202. 0.000 0.000 ↓ 0.0 0

Limit (cost=24.03..28.05 rows=1 width=4) (never executed)

203. 0.000 0.000 ↓ 0.0 0

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

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

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

205. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: ((matricula)::text = (h.matricula)::text)
206. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (disciplina = h.disciplina)
207. 0.000 0.000 ↓ 0.0 0

Index Only Scan using unq_historico_disciplina_matrper_matrperturm_grade_gd_gcgod on historico his_2 (cost=0.43..4.45 rows=1 width=4) (never executed)

  • Index Cond: ((disciplina = h.disciplina) AND (matriculaperiodo = h.matriculaperiodo) AND (matrizcurricular = m.gradecurricularatual))
  • Heap Fetches: 0
208. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=132.02..132.03 rows=1 width=8) (never executed)

209. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=33.56..132.02 rows=1 width=4) (never executed)

  • Join Filter: requerimento.disciplinaporequivalencia
  • Filter: ((requerimento.disciplina = 5,730) OR (mapaequivalenciadisciplinacursada.disciplina = 5,730))
210. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=33.28..123.70 rows=1 width=13) (never executed)

  • Filter: (((requerimento.situacaofinanceira)::text = 'IS'::text) OR (contareceber.codigo IS NULL) OR (contareceber.datavencimento <= CURRENT_DATE))
211. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=32.85..115.24 rows=1 width=20) (never executed)

  • Join Filter: (((turmareposicao.semestral AND ((matper.ano)::text = ''::text) AND ((matper.semestre)::text = ''::text)) OR (turmareposicao.anual AND ((matper.ano)::text = ''::text)) OR ((NOT turmareposicao.anual) AND (NOT turmareposicao.semestral))) AND CASE WHEN (requerimento.matriculaperiodo IS NOT NULL) THEN (requerimento.matriculaperiodo = matper.codigo) ELSE CASE WHEN (requerimento.codigo <> 0) THEN (matper.turma = requerimento.turma) ELSE (matper.codigo = (SubPlan 5)) END END)
212. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=32.43..106.13 rows=1 width=58) (never executed)

213. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=32.01..97.69 rows=1 width=44) (never executed)

214. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=31.73..89.38 rows=1 width=46) (never executed)

215. 0.000 0.000 ↓ 0.0 0

Seq Scan on tiporequerimento (cost=0.00..17.88 rows=2 width=4) (never executed)

  • Filter: ((tipo)::text = 'RE'::text)
216. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on requerimento (cost=31.73..35.74 rows=1 width=50) (never executed)

  • Recheck Cond: ((turmareposicao = turma.codigo) AND (tiporequerimento = tiporequerimento.codigo))
  • Filter: ((situacao)::text <> ALL ('{FD,FI}'::text[]))
217. 0.000 0.000 ↓ 0.0 0

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

218. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_requerimento_turmareposicao (cost=0.00..4.60 rows=24 width=0) (never executed)

  • Index Cond: (turmareposicao = turma.codigo)
219. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on ch_requerimento_tiporequerimento (cost=0.00..26.88 rows=1,394 width=0) (never executed)

  • Index Cond: (tiporequerimento = tiporequerimento.codigo)
220. 0.000 0.000 ↓ 0.0 0

Index Scan using turma_pkey on turma turmareposicao (cost=0.29..8.30 rows=1 width=6) (never executed)

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

Index Scan using matricula_pkey on matricula mat (cost=0.42..8.44 rows=1 width=14) (never executed)

  • Index Cond: ((matricula)::text = (requerimento.matricula)::text)
  • Filter: ((situacao)::text = 'AT'::text)
222. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_matriculaperiodo_matricula on matriculaperiodo matper (cost=0.42..0.62 rows=1 width=24) (never executed)

  • Index Cond: ((matricula)::text = (mat.matricula)::text)
  • Filter: ((situacaomatriculaperiodo)::text = ANY ('{AT,PR}'::text[]))
223.          

SubPlan (for Nested Loop)

224. 0.000 0.000 ↓ 0.0 0

Limit (cost=8.45..8.46 rows=1 width=40) (never executed)

225. 0.000 0.000 ↓ 0.0 0

Sort (cost=8.45..8.46 rows=1 width=40) (never executed)

  • Sort Key: ((((mp_1.ano)::text || '/'::text) || (mp_1.semestre)::text)) DESC, mp_1.periodoletivomatricula DESC
226. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: ((matricula)::text = (requerimento.matricula)::text)
227. 0.000 0.000 ↓ 0.0 0

Index Scan using contareceber_pkey on contareceber (cost=0.43..8.45 rows=1 width=12) (never executed)

  • Index Cond: (codigo = requerimento.contareceber)
228. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_mapaequivalenciadisciplinacursada_codigo on mapaequivalenciadisciplinacursada (cost=0.28..8.30 rows=1 width=8) (never executed)

  • Index Cond: (codigo = requerimento.mapaequivalenciadisciplinacursada)
Planning time : 46.076 ms
Execution time : 38,652.492 ms