explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Wf2z

Settings
# exclusive inclusive rows x rows loops node
1. 32.735 7,892.370 ↑ 7.0 4,669 1

Sort (cost=105,381,026.14..105,381,107.79 rows=32,661 width=2,424) (actual time=7,891.984..7,892.370 rows=4,669 loops=1)

  • Sort Key: "*SELECT* 1".datainicio, "*SELECT* 1".nomeunidadeensino, "*SELECT* 1".identificadorturma, "*SELECT* 1".nomedisciplina
  • Sort Method: quicksort Memory: 2,830kB
2.          

CTE cte_coordenador

3. 0.878 5.910 ↑ 1.0 1,491 1

Nested Loop (cost=121.06..8,044.77 rows=1,491 width=52) (actual time=1.100..5.910 rows=1,491 loops=1)

4. 0.817 2.050 ↑ 1.0 1,491 1

Hash Join (cost=120.64..155.46 rows=1,491 width=16) (actual time=1.085..2.050 rows=1,491 loops=1)

  • Hash Cond: (c.funcionario = funcionario.codigo)
5. 0.185 0.185 ↑ 1.0 1,491 1

Seq Scan on cursocoordenador c (cost=0.00..30.91 rows=1,491 width=16) (actual time=0.009..0.185 rows=1,491 loops=1)

6. 0.546 1.048 ↑ 1.0 3,806 1

Hash (cost=73.06..73.06 rows=3,806 width=8) (actual time=1.048..1.048 rows=3,806 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 181kB
7. 0.502 0.502 ↑ 1.0 3,806 1

Seq Scan on funcionario (cost=0.00..73.06 rows=3,806 width=8) (actual time=0.011..0.502 rows=3,806 loops=1)

8. 2.982 2.982 ↑ 1.0 1 1,491

Index Scan using pessoa_pkey on pessoa pessoa_2 (cost=0.42..5.29 rows=1 width=44) (actual time=0.002..0.002 rows=1 loops=1,491)

  • Index Cond: (codigo = funcionario.pessoa)
9. 36.782 7,859.635 ↑ 7.0 4,669 1

Nested Loop Left Join (cost=18,050.76..105,370,532.56 rows=32,661 width=2,424) (actual time=167.436..7,859.635 rows=4,669 loops=1)

  • Join Filter: ((gradedisciplina.codigo IS NULL) AND (gradecurriculargrupooptativadisciplina.codigo IS NULL))
10. 27.109 5,320.269 ↑ 7.0 4,669 1

Nested Loop Left Join (cost=17,527.32..51,168,240.16 rows=32,661 width=2,368) (actual time=160.155..5,320.269 rows=4,669 loops=1)

11. 41.245 5,218.456 ↑ 4.7 4,669 1

Nested Loop Left Join (cost=17,436.63..45,407,756.84 rows=21,777 width=2,360) (actual time=160.108..5,218.456 rows=4,669 loops=1)

  • Join Filter: (turmadisciplina.gradedisciplina IS NULL)
12. 6.992 5,111.845 ↑ 4.7 4,669 1

Nested Loop Left Join (cost=17,351.43..39,766,751.58 rows=21,777 width=2,356) (actual time=160.043..5,111.845 rows=4,669 loops=1)

13. 1.239 5,081.508 ↑ 4.7 4,669 1

Append (cost=17,351.14..39,754,822.73 rows=21,777 width=2,348) (actual time=160.028..5,081.508 rows=4,669 loops=1)

14. 2.625 4,919.332 ↑ 4.8 4,508 1

Subquery Scan on *SELECT* 1 (cost=17,351.14..39,608,997.19 rows=21,633 width=323) (actual time=160.027..4,919.332 rows=4,508 loops=1)

15. 55.741 4,916.707 ↑ 4.8 4,508 1

HashAggregate (cost=17,351.14..39,608,780.86 rows=21,633 width=335) (actual time=160.026..4,916.707 rows=4,508 loops=1)

  • Group Key: cidade.codigo, unidadeensino.codigo, turma.codigo, disciplina.codigo, pessoa.codigo, horarioturmadiaitem.disciplina, curso.nome, horarioturma.codigo, turno.codigo, periodoletivo.periodoletivo
16. 40.974 132.074 ↑ 1.2 18,136 1

Gather (cost=3,848.46..16,648.07 rows=21,633 width=275) (actual time=23.703..132.074 rows=18,136 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
17. 2.838 91.100 ↑ 1.5 6,045 3 / 3

Hash Left Join (cost=2,848.46..13,484.77 rows=9,014 width=275) (actual time=17.034..91.100 rows=6,045 loops=3)

  • Hash Cond: (turma.curso = curso.codigo)
18. 2.611 87.769 ↑ 1.5 6,045 3 / 3

Hash Left Join (cost=2,819.43..13,431.85 rows=9,014 width=228) (actual time=16.529..87.769 rows=6,045 loops=3)

  • Hash Cond: (turma.periodoletivo = periodoletivo.codigo)
19. 3.225 84.621 ↑ 1.5 6,045 3 / 3

Hash Join (cost=2,789.39..13,378.03 rows=9,014 width=228) (actual time=15.978..84.621 rows=6,045 loops=3)

  • Hash Cond: (turma.turno = turno.codigo)
20. 4.369 81.119 ↑ 1.5 6,045 3 / 3

Nested Loop (cost=2,787.85..13,348.64 rows=9,014 width=213) (actual time=15.521..81.119 rows=6,045 loops=3)

21. 3.117 58.614 ↑ 1.5 6,045 3 / 3

Hash Join (cost=2,787.43..7,252.23 rows=9,014 width=161) (actual time=15.484..58.614 rows=6,045 loops=3)

  • Hash Cond: (horarioturmadiaitem.disciplina = disciplina.codigo)
22. 2.807 52.499 ↑ 1.5 6,045 3 / 3

Hash Join (cost=2,595.47..7,036.59 rows=9,014 width=112) (actual time=12.457..52.499 rows=6,045 loops=3)

  • Hash Cond: (unidadeensino.cidade = cidade.codigo)
23. 2.293 46.053 ↑ 1.5 6,045 3 / 3

Hash Join (cost=2,252.38..6,669.83 rows=9,014 width=93) (actual time=8.755..46.053 rows=6,045 loops=3)

  • Hash Cond: (turma.unidadeensino = unidadeensino.codigo)
24. 3.319 43.330 ↑ 1.5 6,045 3 / 3

Hash Join (cost=2,244.65..6,637.13 rows=9,014 width=73) (actual time=8.306..43.330 rows=6,045 loops=3)

  • Hash Cond: (horarioturma.turma = turma.codigo)
25. 2.820 35.854 ↑ 1.2 8,177 3 / 3

Hash Join (cost=2,046.85..6,413.65 rows=9,777 width=26) (actual time=4.121..35.854 rows=8,177 loops=3)

  • Hash Cond: (horarioturmadia.horarioturma = horarioturma.codigo)
26. 22.727 31.588 ↑ 1.2 8,177 3 / 3

Parallel Hash Join (cost=1,951.10..6,292.20 rows=9,777 width=20) (actual time=2.654..31.588 rows=8,177 loops=3)

  • Hash Cond: (horarioturmadiaitem.horarioturmadia = horarioturmadia.codigo)
27. 6.369 6.369 ↑ 1.2 77,249 3 / 3

Parallel Seq Scan on horarioturmadiaitem (cost=0.00..4,087.61 rows=96,561 width=16) (actual time=0.014..6.369 rows=77,249 loops=3)

28. 1.016 2.492 ↑ 1.8 5,047 3 / 3

Parallel Hash (cost=1,837.67..1,837.67 rows=9,075 width=16) (actual time=2.492..2.492 rows=5,047 loops=3)

  • Buckets: 16,384 Batches: 1 Memory Usage: 864kB
29. 1.134 1.476 ↓ 1.7 15,140 1 / 3

Parallel Bitmap Heap Scan on horarioturmadia (cost=330.55..1,837.67 rows=9,075 width=16) (actual time=1.094..4.427 rows=15,140 loops=1)

  • Recheck Cond: ((data >= '2020-03-06 00:00:00'::timestamp without time zone) AND (data <= '2020-12-31 23:59:59.059'::timestamp without time zone))
  • Heap Blocks: exact=548
30. 0.342 0.342 ↑ 1.0 15,140 1 / 3

Bitmap Index Scan on idx_horarioturmadia_data (cost=0.00..326.69 rows=15,427 width=0) (actual time=1.024..1.025 rows=15,140 loops=1)

  • Index Cond: ((data >= '2020-03-06 00:00:00'::timestamp without time zone) AND (data <= '2020-12-31 23:59:59.059'::timestamp without time zone))
31. 0.551 1.446 ↑ 1.0 3,100 3 / 3

Hash (cost=57.00..57.00 rows=3,100 width=10) (actual time=1.446..1.446 rows=3,100 loops=3)

  • Buckets: 4,096 Batches: 1 Memory Usage: 166kB
32. 0.895 0.895 ↑ 1.0 3,100 3 / 3

Seq Scan on horarioturma (cost=0.00..57.00 rows=3,100 width=10) (actual time=0.333..0.895 rows=3,100 loops=3)

33. 1.435 4.157 ↑ 1.0 4,403 3 / 3

Hash (cost=142.76..142.76 rows=4,403 width=47) (actual time=4.157..4.157 rows=4,403 loops=3)

  • Buckets: 8,192 Batches: 1 Memory Usage: 437kB
34. 2.722 2.722 ↑ 1.0 4,403 3 / 3

Seq Scan on turma (cost=0.00..142.76 rows=4,403 width=47) (actual time=0.242..2.722 rows=4,403 loops=3)

  • Filter: ((NOT anual) AND (NOT semestral))
  • Rows Removed by Filter: 373
35. 0.022 0.430 ↑ 1.0 77 3 / 3

Hash (cost=6.77..6.77 rows=77 width=24) (actual time=0.430..0.430 rows=77 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 13kB
36. 0.408 0.408 ↑ 1.0 77 3 / 3

Seq Scan on unidadeensino (cost=0.00..6.77 rows=77 width=24) (actual time=0.368..0.408 rows=77 loops=3)

37. 1.802 3.639 ↑ 1.0 10,626 3 / 3

Hash (cost=210.26..210.26 rows=10,626 width=23) (actual time=3.639..3.639 rows=10,626 loops=3)

  • Buckets: 16,384 Batches: 1 Memory Usage: 706kB
38. 1.837 1.837 ↑ 1.0 10,626 3 / 3

Seq Scan on cidade (cost=0.00..210.26 rows=10,626 width=23) (actual time=0.341..1.837 rows=10,626 loops=3)

39. 1.143 2.998 ↑ 1.0 5,465 3 / 3

Hash (cost=123.65..123.65 rows=5,465 width=49) (actual time=2.998..2.998 rows=5,465 loops=3)

  • Buckets: 8,192 Batches: 1 Memory Usage: 500kB
40. 1.855 1.855 ↑ 1.0 5,465 3 / 3

Seq Scan on disciplina (cost=0.00..123.65 rows=5,465 width=49) (actual time=0.516..1.855 rows=5,465 loops=3)

41. 18.136 18.136 ↑ 1.0 1 18,136 / 3

Index Scan using pessoa_pkey on pessoa (cost=0.42..0.68 rows=1 width=56) (actual time=0.003..0.003 rows=1 loops=18,136)

  • Index Cond: (codigo = horarioturmadiaitem.professor)
42. 0.013 0.277 ↑ 1.0 24 3 / 3

Hash (cost=1.24..1.24 rows=24 width=19) (actual time=0.277..0.277 rows=24 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
43. 0.264 0.264 ↑ 1.0 24 3 / 3

Seq Scan on turno (cost=0.00..1.24 rows=24 width=19) (actual time=0.258..0.264 rows=24 loops=3)

44. 0.128 0.537 ↑ 1.0 846 3 / 3

Hash (cost=19.46..19.46 rows=846 width=8) (actual time=0.537..0.537 rows=846 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 42kB
45. 0.409 0.409 ↑ 1.0 846 3 / 3

Seq Scan on periodoletivo (cost=0.00..19.46 rows=846 width=8) (actual time=0.266..0.409 rows=846 loops=3)

46. 0.099 0.493 ↑ 1.0 446 3 / 3

Hash (cost=23.46..23.46 rows=446 width=51) (actual time=0.493..0.493 rows=446 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 46kB
47. 0.394 0.394 ↑ 1.0 446 3 / 3

Seq Scan on curso (cost=0.00..23.46 rows=446 width=51) (actual time=0.234..0.394 rows=446 loops=3)

48.          

SubPlan (for HashAggregate)

49. 9.016 982.744 ↑ 1.0 1 4,508

Aggregate (cost=288.68..288.69 rows=1 width=8) (actual time=0.217..0.218 rows=1 loops=4,508)

50. 4.508 973.728 ↑ 27.5 2 4,508

Unique (cost=287.72..288.00 rows=55 width=4) (actual time=0.216..0.216 rows=2 loops=4,508)

51. 13.524 969.220 ↑ 27.5 2 4,508

Sort (cost=287.72..287.86 rows=55 width=4) (actual time=0.215..0.215 rows=2 loops=4,508)

  • Sort Key: arquivo.codigo
  • Sort Method: quicksort Memory: 25kB
52. 103.684 955.696 ↑ 27.5 2 4,508

Append (cost=10.15..286.13 rows=55 width=4) (actual time=0.172..0.212 rows=2 loops=4,508)

53. 130.732 252.448 ↑ 1.0 1 4,508

Bitmap Heap Scan on arquivo (cost=10.15..14.17 rows=1 width=4) (actual time=0.055..0.056 rows=1 loops=4,508)

  • Recheck Cond: ((disciplina = horarioturmadiaitem.disciplina) AND (professor = pessoa.codigo))
  • Filter: (turma IS NULL)
  • Rows Removed by Filter: 31
  • Heap Blocks: exact=112,773
54. 19.079 121.716 ↓ 0.0 0 4,508

BitmapAnd (cost=10.15..10.15 rows=1 width=0) (actual time=0.027..0.027 rows=0 loops=4,508)

55. 58.604 58.604 ↓ 1.6 102 4,508

Bitmap Index Scan on ch_arquivo_disciplina (cost=0.00..4.89 rows=62 width=0) (actual time=0.013..0.013 rows=102 loops=4,508)

  • Index Cond: (disciplina = horarioturmadiaitem.disciplina)
56. 44.033 44.033 ↓ 1.2 93 4,003

Bitmap Index Scan on ch_arquivo_professor (cost=0.00..5.01 rows=78 width=0) (actual time=0.011..0.011 rows=93 loops=4,003)

  • Index Cond: (professor = pessoa.codigo)
57. 4.508 94.668 ↓ 0.0 0 4,508

Bitmap Heap Scan on arquivo arquivo_1 (cost=10.00..14.02 rows=1 width=4) (actual time=0.021..0.021 rows=0 loops=4,508)

  • Recheck Cond: ((turma = horarioturma.turma) AND (disciplina = horarioturmadiaitem.disciplina))
  • Filter: (professor IS NULL)
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=662
58. 14.814 90.160 ↓ 0.0 0 4,508

BitmapAnd (cost=10.00..10.00 rows=1 width=0) (actual time=0.020..0.020 rows=0 loops=4,508)

59. 31.556 31.556 ↑ 1.1 51 4,508

Bitmap Index Scan on ch_arquivo_turma (cost=0.00..4.86 rows=58 width=0) (actual time=0.007..0.007 rows=51 loops=4,508)

  • Index Cond: (turma = horarioturma.turma)
60. 43.790 43.790 ↓ 1.7 104 4,379

Bitmap Index Scan on ch_arquivo_disciplina (cost=0.00..4.89 rows=62 width=0) (actual time=0.010..0.010 rows=104 loops=4,379)

  • Index Cond: (disciplina = horarioturmadiaitem.disciplina)
61. 4.508 81.144 ↓ 0.0 0 4,508

Bitmap Heap Scan on arquivo arquivo_2 (cost=10.00..14.02 rows=1 width=4) (actual time=0.018..0.018 rows=0 loops=4,508)

  • Recheck Cond: ((turma = horarioturma.turma) AND (disciplina = horarioturmadiaitem.disciplina))
  • Filter: (professor = pessoa.codigo)
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=662
62. 10.177 76.636 ↓ 0.0 0 4,508

BitmapAnd (cost=10.00..10.00 rows=1 width=0) (actual time=0.017..0.017 rows=0 loops=4,508)

63. 27.048 27.048 ↑ 1.1 51 4,508

Bitmap Index Scan on ch_arquivo_turma (cost=0.00..4.86 rows=58 width=0) (actual time=0.006..0.006 rows=51 loops=4,508)

  • Index Cond: (turma = horarioturma.turma)
64. 39.411 39.411 ↓ 1.7 104 4,379

Bitmap Index Scan on ch_arquivo_disciplina (cost=0.00..4.89 rows=62 width=0) (actual time=0.009..0.009 rows=104 loops=4,379)

  • Index Cond: (disciplina = horarioturmadiaitem.disciplina)
65. 383.180 423.752 ↑ 52.0 1 4,508

Bitmap Heap Scan on arquivo arquivo_3 (cost=4.90..243.11 rows=52 width=4) (actual time=0.078..0.094 rows=1 loops=4,508)

  • Recheck Cond: (disciplina = horarioturmadiaitem.disciplina)
  • Filter: ((professor IS NULL) AND (turma IS NULL))
  • Rows Removed by Filter: 101
  • Heap Blocks: exact=375,398
66. 40.572 40.572 ↓ 1.6 102 4,508

Bitmap Index Scan on ch_arquivo_disciplina (cost=0.00..4.89 rows=62 width=0) (actual time=0.009..0.009 rows=102 loops=4,508)

  • Index Cond: (disciplina = horarioturmadiaitem.disciplina)
67. 4.508 888.076 ↑ 1.0 1 4,508

Aggregate (cost=322.67..322.68 rows=1 width=8) (actual time=0.197..0.197 rows=1 loops=4,508)

68. 0.000 883.568 ↑ 1.0 1 4,508

Nested Loop (cost=0.57..322.67 rows=1 width=4) (actual time=0.161..0.196 rows=1 loops=4,508)

69. 117.208 117.208 ↓ 4.8 86 4,508

Index Scan using ch_vagaturmadisciplina_disciplina on vagaturmadisciplina (cost=0.29..23.97 rows=18 width=8) (actual time=0.004..0.026 rows=86 loops=4,508)

  • Index Cond: (disciplina = horarioturmadiaitem.disciplina)
70. 776.082 776.082 ↓ 0.0 0 388,041

Index Scan using vagaturma_pkey on vagaturma (cost=0.28..16.58 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=388,041)

  • Index Cond: (codigo = vagaturmadisciplina.vagaturma)
  • Filter: (((ano)::text = (horarioturma.anovigente)::text) AND ((semestre)::text = (horarioturma.semestrevigente)::text) AND (((NOT turma.turmaagrupada) AND (turma = turma.codigo)) OR (turma.turmaagrupada AND (SubPlan 9))))
  • Rows Removed by Filter: 1
71.          

SubPlan (for Index Scan)

72. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on turmaagrupada turmaagrupada_3 (cost=8.71..12.72 rows=1 width=4) (never executed)

  • Recheck Cond: ((turmaorigem = turma.codigo) AND (turma = vagaturma.turma))
73. 0.000 0.000 ↓ 0.0 0

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

74. 0.000 0.000 ↓ 0.0 0

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

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

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

  • Index Cond: (turma = vagaturma.turma)
76. 4.508 829.472 ↑ 1.0 1 4,508

Aggregate (cost=322.67..322.68 rows=1 width=8) (actual time=0.184..0.184 rows=1 loops=4,508)

77. 0.000 824.964 ↑ 1.0 1 4,508

Nested Loop (cost=0.57..322.67 rows=1 width=4) (actual time=0.151..0.183 rows=1 loops=4,508)

78. 90.160 90.160 ↓ 4.8 86 4,508

Index Scan using ch_vagaturmadisciplina_disciplina on vagaturmadisciplina vagaturmadisciplina_1 (cost=0.29..23.97 rows=18 width=8) (actual time=0.003..0.020 rows=86 loops=4,508)

  • Index Cond: (disciplina = horarioturmadiaitem.disciplina)
79. 776.082 776.082 ↓ 0.0 0 388,041

Index Scan using vagaturma_pkey on vagaturma vagaturma_1 (cost=0.28..16.58 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=388,041)

  • Index Cond: (codigo = vagaturmadisciplina_1.vagaturma)
  • Filter: (((ano)::text = (horarioturma.anovigente)::text) AND ((semestre)::text = (horarioturma.semestrevigente)::text) AND (((NOT turma.turmaagrupada) AND (turma = turma.codigo)) OR (turma.turmaagrupada AND (SubPlan 11))))
  • Rows Removed by Filter: 1
80.          

SubPlan (for Index Scan)

81. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on turmaagrupada turmaagrupada_4 (cost=8.71..12.72 rows=1 width=4) (never executed)

  • Recheck Cond: ((turmaorigem = turma.codigo) AND (turma = vagaturma_1.turma))
82. 0.000 0.000 ↓ 0.0 0

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

83. 0.000 0.000 ↓ 0.0 0

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

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

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

  • Index Cond: (turma = vagaturma_1.turma)
85. 58.604 1,068.396 ↑ 1.0 1 4,508

Aggregate (cost=254.25..254.26 rows=1 width=8) (actual time=0.237..0.237 rows=1 loops=4,508)

86. 123.363 1,009.792 ↓ 1.8 48 4,508

Nested Loop (cost=1.40..254.18 rows=27 width=4) (actual time=0.016..0.224 rows=48 loops=4,508)

87. 151.610 658.168 ↓ 1.9 51 4,508

Nested Loop (cost=1.12..246.01 rows=27 width=4) (actual time=0.012..0.146 rows=51 loops=4,508)

88. 18.032 166.796 ↓ 2.1 38 4,508

Nested Loop (cost=0.70..45.01 rows=18 width=4) (actual time=0.008..0.037 rows=38 loops=4,508)

89. 13.524 13.524 ↑ 1.0 1 4,508

Index Only Scan using horarioturma_pkey on horarioturma ht (cost=0.28..4.30 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=4,508)

  • Index Cond: (codigo = horarioturma.codigo)
  • Heap Fetches: 0
90. 135.240 135.240 ↓ 2.1 38 4,508

Index Scan using fk_horarioturmadia_horarioturma on horarioturmadia htd (cost=0.42..40.53 rows=18 width=8) (actual time=0.005..0.030 rows=38 loops=4,508)

  • Index Cond: (horarioturma = horarioturma.codigo)
  • Filter: (data < max(horarioturmadia.data))
  • Rows Removed by Filter: 17
91. 339.762 339.762 ↑ 2.0 1 169,881

Index Scan using idx_horturdiaitem_horturmdia on horarioturmadiaitem htdi (cost=0.42..11.15 rows=2 width=8) (actual time=0.002..0.002 rows=1 loops=169,881)

  • Index Cond: (horarioturmadia = htd.codigo)
92. 228.261 228.261 ↑ 1.0 1 228,261

Index Only Scan using disciplina_pkey on disciplina dis (cost=0.28..0.30 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=228,261)

  • Index Cond: (codigo = htdi.disciplina)
  • Filter: (codigo <> disciplina.codigo)
  • Rows Removed by Filter: 0
  • Heap Fetches: 0
93. 9.016 960.204 ↑ 1.0 1 4,508

Subquery Scan on ordem (cost=639.35..641.81 rows=1 width=8) (actual time=0.210..0.213 rows=1 loops=4,508)

  • Filter: (ordem.disciplina = horarioturmadiaitem.disciplina)
  • Rows Removed by Filter: 17
94. 49.588 951.188 ↑ 4.6 18 4,508

WindowAgg (cost=639.35..640.78 rows=82 width=20) (actual time=0.203..0.211 rows=18 loops=4,508)

95. 27.048 901.600 ↑ 4.6 18 4,508

Sort (cost=639.35..639.55 rows=82 width=12) (actual time=0.199..0.200 rows=18 loops=4,508)

  • Sort Key: (min(htd_1.data))
  • Sort Method: quicksort Memory: 25kB
96. 76.636 874.552 ↑ 4.6 18 4,508

GroupAggregate (cost=635.31..636.74 rows=82 width=12) (actual time=0.177..0.194 rows=18 loops=4,508)

  • Group Key: htdi_1.disciplina
97. 81.144 797.916 ↑ 1.1 73 4,508

Sort (cost=635.31..635.51 rows=82 width=12) (actual time=0.174..0.177 rows=73 loops=4,508)

  • Sort Key: htdi_1.disciplina
  • Sort Method: quicksort Memory: 28kB
98. 139.222 716.772 ↑ 1.1 73 4,508

Nested Loop (cost=0.84..632.70 rows=82 width=12) (actual time=0.008..0.159 rows=73 loops=4,508)

99. 81.144 81.144 ↓ 1.0 55 4,508

Index Scan using fk_horarioturmadia_horarioturma on horarioturmadia htd_1 (cost=0.42..40.40 rows=54 width=12) (actual time=0.004..0.018 rows=55 loops=4,508)

  • Index Cond: (horarioturma = horarioturma.codigo)
100. 496.406 496.406 ↑ 2.0 1 248,203

Index Scan using idx_horturdiaitem_horturmdia on horarioturmadiaitem htdi_1 (cost=0.42..10.95 rows=2 width=8) (actual time=0.002..0.002 rows=1 loops=248,203)

  • Index Cond: (horarioturmadia = htd_1.codigo)
  • Filter: (disciplina IS NOT NULL)
101. 0.107 160.937 ↓ 1.1 161 1

Subquery Scan on *SELECT* 2 (cost=1,853.77..145,716.66 rows=144 width=328) (actual time=11.336..160.937 rows=161 loops=1)

102. 1.143 160.830 ↓ 1.1 161 1

Group (cost=1,853.77..145,714.50 rows=144 width=328) (actual time=11.334..160.830 rows=161 loops=1)

  • Group Key: cidade_1.codigo, unidadeensino_1.codigo, turma_1.codigo, disciplina_1.codigo, pessoa_1.codigo, curso_1.nome, programacaotutoriaonline.codigo, turno_1.codigo, periodoletivo_1.periodoletivo
103. 0.308 10.440 ↓ 1.1 161 1

Sort (cost=1,853.77..1,854.13 rows=144 width=280) (actual time=10.388..10.440 rows=161 loops=1)

  • Sort Key: cidade_1.codigo, unidadeensino_1.codigo, turma_1.codigo, disciplina_1.codigo, pessoa_1.codigo, curso_1.nome, programacaotutoriaonline.codigo, turno_1.codigo, periodoletivo_1.periodoletivo
  • Sort Method: quicksort Memory: 103kB
104. 0.158 10.132 ↓ 1.1 161 1

Nested Loop Left Join (cost=461.80..1,848.61 rows=144 width=280) (actual time=6.917..10.132 rows=161 loops=1)

105. 0.162 9.813 ↓ 1.1 161 1

Nested Loop Left Join (cost=461.53..1,803.84 rows=144 width=233) (actual time=6.909..9.813 rows=161 loops=1)

106. 0.091 9.490 ↓ 1.1 161 1

Hash Join (cost=461.25..1,759.63 rows=144 width=233) (actual time=6.900..9.490 rows=161 loops=1)

  • Hash Cond: (turma_1.turno = turno_1.codigo)
107. 0.069 9.377 ↓ 1.1 161 1

Nested Loop (cost=459.71..1,757.64 rows=144 width=218) (actual time=6.867..9.377 rows=161 loops=1)

108. 0.094 8.825 ↓ 1.1 161 1

Hash Join (cost=459.29..738.41 rows=144 width=166) (actual time=6.853..8.825 rows=161 loops=1)

  • Hash Cond: (programacaotutoriaonline.disciplina = disciplina_1.codigo)
109. 0.496 6.435 ↓ 1.1 161 1

Merge Join (cost=267.33..546.07 rows=144 width=117) (actual time=4.547..6.435 rows=161 loops=1)

  • Merge Cond: (cidade_1.codigo = unidadeensino_1.cidade)
110. 1.392 1.392 ↑ 1.9 5,614 1

Index Scan using cidade_pkey on cidade cidade_1 (cost=0.29..495.84 rows=10,626 width=23) (actual time=0.012..1.392 rows=5,614 loops=1)

111. 0.113 4.547 ↓ 1.1 161 1

Sort (cost=267.04..267.40 rows=144 width=98) (actual time=4.531..4.547 rows=161 loops=1)

  • Sort Key: unidadeensino_1.cidade
  • Sort Method: quicksort Memory: 59kB
112. 0.066 4.434 ↓ 1.1 161 1

Hash Join (cost=237.97..261.88 rows=144 width=98) (actual time=4.092..4.434 rows=161 loops=1)

  • Hash Cond: (turma_1.unidadeensino = unidadeensino_1.codigo)
113. 0.100 4.307 ↓ 1.1 161 1

Hash Join (cost=230.24..253.75 rows=144 width=78) (actual time=4.024..4.307 rows=161 loops=1)

  • Hash Cond: (programacaotutoriaonline.turma = turma_1.codigo)
114. 0.177 0.518 ↓ 1.0 161 1

Hash Join (cost=32.44..55.54 rows=155 width=31) (actual time=0.302..0.518 rows=161 loops=1)

  • Hash Cond: (programacaotutoriaonlineprofessor.programacaotutoriaonline = programacaotutoriaonline.codigo)
115. 0.085 0.085 ↑ 1.0 1,116 1

Seq Scan on programacaotutoriaonlineprofessor (cost=0.00..20.16 rows=1,116 width=8) (actual time=0.008..0.085 rows=1,116 loops=1)

116. 0.034 0.256 ↑ 1.0 143 1

Hash (cost=30.63..30.63 rows=145 width=27) (actual time=0.256..0.256 rows=143 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 16kB
117. 0.222 0.222 ↑ 1.0 143 1

Seq Scan on programacaotutoriaonline (cost=0.00..30.63 rows=145 width=27) (actual time=0.010..0.222 rows=143 loops=1)

  • Filter: ((datainicioaula >= '2020-03-06'::date) AND (datainicioaula <= '2020-12-31'::date))
  • Rows Removed by Filter: 899
118. 1.411 3.689 ↑ 1.0 4,403 1

Hash (cost=142.76..142.76 rows=4,403 width=47) (actual time=3.689..3.689 rows=4,403 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 437kB
119. 2.278 2.278 ↑ 1.0 4,403 1

Seq Scan on turma turma_1 (cost=0.00..142.76 rows=4,403 width=47) (actual time=0.010..2.278 rows=4,403 loops=1)

  • Filter: ((NOT anual) AND (NOT semestral))
  • Rows Removed by Filter: 373
120. 0.021 0.061 ↑ 1.0 77 1

Hash (cost=6.77..6.77 rows=77 width=24) (actual time=0.061..0.061 rows=77 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 13kB
121. 0.040 0.040 ↑ 1.0 77 1

Seq Scan on unidadeensino unidadeensino_1 (cost=0.00..6.77 rows=77 width=24) (actual time=0.010..0.040 rows=77 loops=1)

122. 1.158 2.296 ↑ 1.0 5,465 1

Hash (cost=123.65..123.65 rows=5,465 width=49) (actual time=2.296..2.296 rows=5,465 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 500kB
123. 1.138 1.138 ↑ 1.0 5,465 1

Seq Scan on disciplina disciplina_1 (cost=0.00..123.65 rows=5,465 width=49) (actual time=0.009..1.138 rows=5,465 loops=1)

124. 0.483 0.483 ↑ 1.0 1 161

Index Scan using pessoa_pkey on pessoa pessoa_1 (cost=0.42..7.08 rows=1 width=56) (actual time=0.003..0.003 rows=1 loops=161)

  • Index Cond: (codigo = programacaotutoriaonlineprofessor.professor)
125. 0.006 0.022 ↑ 1.0 24 1

Hash (cost=1.24..1.24 rows=24 width=19) (actual time=0.022..0.022 rows=24 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
126. 0.016 0.016 ↑ 1.0 24 1

Seq Scan on turno turno_1 (cost=0.00..1.24 rows=24 width=19) (actual time=0.011..0.016 rows=24 loops=1)

127. 0.161 0.161 ↑ 1.0 1 161

Index Scan using periodoletivo_pkey on periodoletivo periodoletivo_1 (cost=0.28..0.31 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=161)

  • Index Cond: (codigo = turma_1.periodoletivo)
128. 0.161 0.161 ↑ 1.0 1 161

Index Scan using curso_pkey on curso curso_1 (cost=0.27..0.31 rows=1 width=51) (actual time=0.001..0.001 rows=1 loops=161)

  • Index Cond: (codigo = turma_1.curso)
129.          

SubPlan (for Group)

130. 0.161 8.372 ↑ 1.0 1 161

Aggregate (cost=288.68..288.69 rows=1 width=8) (actual time=0.052..0.052 rows=1 loops=161)

131. 0.161 8.211 ↓ 0.0 0 161

Unique (cost=287.72..288.00 rows=55 width=4) (actual time=0.051..0.051 rows=0 loops=161)

132. 0.322 8.050 ↓ 0.0 0 161

Sort (cost=287.72..287.86 rows=55 width=4) (actual time=0.050..0.050 rows=0 loops=161)

  • Sort Key: arquivo_4.codigo
  • Sort Method: quicksort Memory: 25kB
133. 3.381 7.728 ↓ 0.0 0 161

Append (cost=10.15..286.13 rows=55 width=4) (actual time=0.048..0.048 rows=0 loops=161)

134. 0.000 1.127 ↓ 0.0 0 161

Bitmap Heap Scan on arquivo arquivo_4 (cost=10.15..14.17 rows=1 width=4) (actual time=0.007..0.007 rows=0 loops=161)

  • Recheck Cond: ((disciplina = programacaotutoriaonline.disciplina) AND (professor = pessoa_1.codigo))
  • Filter: (turma IS NULL)
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=6
135. 0.259 1.127 ↓ 0.0 0 161

BitmapAnd (cost=10.15..10.15 rows=1 width=0) (actual time=0.007..0.007 rows=0 loops=161)

136. 0.644 0.644 ↑ 20.7 3 161

Bitmap Index Scan on ch_arquivo_disciplina (cost=0.00..4.89 rows=62 width=0) (actual time=0.004..0.004 rows=3 loops=161)

  • Index Cond: (disciplina = programacaotutoriaonline.disciplina)
137. 0.224 0.224 ↑ 1.9 42 32

Bitmap Index Scan on ch_arquivo_professor (cost=0.00..5.01 rows=78 width=0) (actual time=0.007..0.007 rows=42 loops=32)

  • Index Cond: (professor = pessoa_1.codigo)
138. 0.161 1.288 ↓ 0.0 0 161

Bitmap Heap Scan on arquivo arquivo_5 (cost=10.00..14.02 rows=1 width=4) (actual time=0.008..0.008 rows=0 loops=161)

  • Recheck Cond: ((turma = programacaotutoriaonline.turma) AND (disciplina = programacaotutoriaonline.disciplina))
  • Filter: (professor IS NULL)
139. 0.259 1.127 ↓ 0.0 0 161

BitmapAnd (cost=10.00..10.00 rows=1 width=0) (actual time=0.007..0.007 rows=0 loops=161)

140. 0.644 0.644 ↑ 5.3 11 161

Bitmap Index Scan on ch_arquivo_turma (cost=0.00..4.86 rows=58 width=0) (actual time=0.004..0.004 rows=11 loops=161)

  • Index Cond: (turma = programacaotutoriaonline.turma)
141. 0.224 0.224 ↑ 62.0 1 112

Bitmap Index Scan on ch_arquivo_disciplina (cost=0.00..4.89 rows=62 width=0) (actual time=0.002..0.002 rows=1 loops=112)

  • Index Cond: (disciplina = programacaotutoriaonline.disciplina)
142. 0.000 0.966 ↓ 0.0 0 161

Bitmap Heap Scan on arquivo arquivo_6 (cost=10.00..14.02 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=161)

  • Recheck Cond: ((turma = programacaotutoriaonline.turma) AND (disciplina = programacaotutoriaonline.disciplina))
  • Filter: (professor = pessoa_1.codigo)
143. 0.259 0.966 ↓ 0.0 0 161

BitmapAnd (cost=10.00..10.00 rows=1 width=0) (actual time=0.006..0.006 rows=0 loops=161)

144. 0.483 0.483 ↑ 5.3 11 161

Bitmap Index Scan on ch_arquivo_turma (cost=0.00..4.86 rows=58 width=0) (actual time=0.003..0.003 rows=11 loops=161)

  • Index Cond: (turma = programacaotutoriaonline.turma)
145. 0.224 0.224 ↑ 62.0 1 112

Bitmap Index Scan on ch_arquivo_disciplina (cost=0.00..4.89 rows=62 width=0) (actual time=0.002..0.002 rows=1 loops=112)

  • Index Cond: (disciplina = programacaotutoriaonline.disciplina)
146. 0.644 0.966 ↓ 0.0 0 161

Bitmap Heap Scan on arquivo arquivo_7 (cost=4.90..243.11 rows=52 width=4) (actual time=0.006..0.006 rows=0 loops=161)

  • Recheck Cond: (disciplina = programacaotutoriaonline.disciplina)
  • Filter: ((professor IS NULL) AND (turma IS NULL))
  • Rows Removed by Filter: 3
  • Heap Blocks: exact=362
147. 0.322 0.322 ↑ 20.7 3 161

Bitmap Index Scan on ch_arquivo_disciplina (cost=0.00..4.89 rows=62 width=0) (actual time=0.002..0.002 rows=3 loops=161)

  • Index Cond: (disciplina = programacaotutoriaonline.disciplina)
148. 0.161 52.325 ↑ 1.0 1 161

Aggregate (cost=322.67..322.68 rows=1 width=8) (actual time=0.325..0.325 rows=1 loops=161)

149. 19.732 52.164 ↓ 0.0 0 161

Nested Loop (cost=0.57..322.67 rows=1 width=4) (actual time=0.324..0.324 rows=0 loops=161)

150. 5.474 5.474 ↓ 9.3 167 161

Index Scan using ch_vagaturmadisciplina_disciplina on vagaturmadisciplina vagaturmadisciplina_2 (cost=0.29..23.97 rows=18 width=8) (actual time=0.003..0.034 rows=167 loops=161)

  • Index Cond: (disciplina = programacaotutoriaonline.disciplina)
151. 26.958 26.958 ↓ 0.0 0 26,958

Index Scan using vagaturma_pkey on vagaturma vagaturma_2 (cost=0.28..16.58 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=26,958)

  • Index Cond: (codigo = vagaturmadisciplina_2.vagaturma)
  • Filter: (((ano)::text = (programacaotutoriaonline.ano)::text) AND ((semestre)::text = (programacaotutoriaonline.semestre)::text) AND (((NOT turma_1.turmaagrupada) AND (turma = turma_1.codigo)) OR (turma_1.turmaagrupada AND (SubPlan 16))))
  • Rows Removed by Filter: 1
152.          

SubPlan (for Index Scan)

153. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on turmaagrupada turmaagrupada_5 (cost=8.71..12.72 rows=1 width=4) (never executed)

  • Recheck Cond: ((turmaorigem = turma_1.codigo) AND (turma = vagaturma_2.turma))
154. 0.000 0.000 ↓ 0.0 0

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

155. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (turmaorigem = turma_1.codigo)
156. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (turma = vagaturma_2.turma)
157. 0.161 50.876 ↑ 1.0 1 161

Aggregate (cost=322.67..322.68 rows=1 width=8) (actual time=0.316..0.316 rows=1 loops=161)

158. 18.605 50.715 ↓ 0.0 0 161

Nested Loop (cost=0.57..322.67 rows=1 width=4) (actual time=0.315..0.315 rows=0 loops=161)

159. 5.152 5.152 ↓ 9.3 167 161

Index Scan using ch_vagaturmadisciplina_disciplina on vagaturmadisciplina vagaturmadisciplina_3 (cost=0.29..23.97 rows=18 width=8) (actual time=0.002..0.032 rows=167 loops=161)

  • Index Cond: (disciplina = programacaotutoriaonline.disciplina)
160. 26.958 26.958 ↓ 0.0 0 26,958

Index Scan using vagaturma_pkey on vagaturma vagaturma_3 (cost=0.28..16.58 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=26,958)

  • Index Cond: (codigo = vagaturmadisciplina_3.vagaturma)
  • Filter: (((ano)::text = (programacaotutoriaonline.ano)::text) AND ((semestre)::text = (programacaotutoriaonline.semestre)::text) AND (((NOT turma_1.turmaagrupada) AND (turma = turma_1.codigo)) OR (turma_1.turmaagrupada AND (SubPlan 18))))
  • Rows Removed by Filter: 1
161.          

SubPlan (for Index Scan)

162. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on turmaagrupada turmaagrupada_6 (cost=8.71..12.72 rows=1 width=4) (never executed)

  • Recheck Cond: ((turmaorigem = turma_1.codigo) AND (turma = vagaturma_3.turma))
163. 0.000 0.000 ↓ 0.0 0

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

164. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (turmaorigem = turma_1.codigo)
165. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (turma = vagaturma_3.turma)
166. 0.644 1.127 ↑ 1.0 1 161

Aggregate (cost=12.60..12.61 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=161)

167. 0.000 0.483 ↓ 0.0 0 161

Nested Loop (cost=0.56..12.60 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=161)

168. 0.483 0.483 ↓ 0.0 0 161

Index Scan using programacaotutoriaonline_pkey on programacaotutoriaonline pto (cost=0.28..8.30 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=161)

  • Index Cond: (codigo = programacaotutoriaonline.codigo)
  • Filter: (dataterminoaula < programacaotutoriaonline.dataterminoaula)
  • Rows Removed by Filter: 1
169. 0.000 0.000 ↓ 0.0 0

Index Only Scan using disciplina_pkey on disciplina dis_1 (cost=0.28..4.30 rows=1 width=4) (never executed)

  • Index Cond: (codigo = pto.disciplina)
  • Filter: (codigo <> disciplina_1.codigo)
  • Heap Fetches: 0
170. 2.415 36.547 ↑ 1.0 1 161

Subquery Scan on ordem_1 (cost=44.23..52.33 rows=1 width=8) (actual time=0.172..0.227 rows=1 loops=161)

  • Filter: (ordem_1.disciplina = programacaotutoriaonline.disciplina)
  • Rows Removed by Filter: 269
171. 17.871 34.132 ↑ 1.0 270 161

WindowAgg (cost=44.23..48.96 rows=270 width=16) (actual time=0.090..0.212 rows=270 loops=161)

172. 9.016 16.261 ↑ 1.0 270 161

Sort (cost=44.23..44.91 rows=270 width=8) (actual time=0.088..0.101 rows=270 loops=161)

  • Sort Key: (min(pto_1.datainicioaula))
  • Sort Method: quicksort Memory: 37kB
173. 7.074 7.245 ↑ 1.0 270 161

HashAggregate (cost=30.63..33.33 rows=270 width=8) (actual time=0.004..0.045 rows=270 loops=161)

  • Group Key: pto_1.disciplina
174. 0.171 0.171 ↑ 1.0 1,042 1

Seq Scan on programacaotutoriaonline pto_1 (cost=0.00..25.42 rows=1,042 width=8) (actual time=0.010..0.171 rows=1,042 loops=1)

  • Filter: (disciplina IS NOT NULL)
175. 23.345 23.345 ↑ 1.0 1 4,669

Index Scan using idx_turmadisciplina_turma_disciplina on turmadisciplina (cost=0.29..0.53 rows=1 width=16) (actual time=0.004..0.005 rows=1 loops=4,669)

  • Index Cond: ((turma = "*SELECT* 1".turma) AND (disciplina = "*SELECT* 1".disciplina))
176. 4.669 65.366 ↓ 0.0 0 4,669

Bitmap Heap Scan on gradecurriculargrupooptativadisciplina (cost=85.20..259.03 rows=1 width=8) (actual time=0.014..0.014 rows=0 loops=4,669)

  • Recheck Cond: ((codigo = (SubPlan 5)) OR (turmadisciplina.gradecurriculargrupooptativadisciplina = codigo))
  • Filter: (("*SELECT* 1".turmaagrupada AND (codigo = (SubPlan 5))) OR (turmadisciplina.gradecurriculargrupooptativadisciplina = codigo))
177. 60.697 60.697 ↓ 0.0 0 4,669

BitmapOr (cost=85.20..85.20 rows=2 width=0) (actual time=0.013..0.013 rows=0 loops=4,669)

178. 0.000 0.000 ↓ 0.0 0 4,669

Bitmap Index Scan on gradecurriculargrupooptativadisciplina_pkey (cost=0.00..85.04 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=4,669)

  • Index Cond: (codigo = (SubPlan 5))
179.          

SubPlan (for Bitmap Index Scan)

180. 4.669 51.359 ↑ 1.0 1 4,669

Aggregate (cost=84.89..84.90 rows=1 width=4) (actual time=0.011..0.011 rows=1 loops=4,669)

181. 13.996 46.690 ↓ 0.0 0 4,669

Hash Join (cost=15.20..84.89 rows=1 width=4) (actual time=0.010..0.010 rows=0 loops=4,669)

  • Hash Cond: (td_1.turma = turmaagrupada_1.turma)
182. 0.011 0.011 ↑ 20.0 1 1

Index Scan using ch_turmadisciplina_disciplina on turmadisciplina td_1 (cost=0.29..69.89 rows=20 width=8) (actual time=0.011..0.011 rows=1 loops=1)

  • Index Cond: (disciplina = "*SELECT* 1".disciplina)
183. 18.676 32.683 ↓ 0.0 0 4,669

Hash (cost=14.79..14.79 rows=10 width=4) (actual time=0.007..0.007 rows=0 loops=4,669)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
184. 4.669 14.007 ↓ 0.0 0 4,669

Bitmap Heap Scan on turmaagrupada turmaagrupada_1 (cost=4.23..14.79 rows=10 width=4) (actual time=0.003..0.003 rows=0 loops=4,669)

  • Recheck Cond: (turmaorigem = "*SELECT* 1".turma)
185. 9.338 9.338 ↓ 0.0 0 4,669

Bitmap Index Scan on idx_turmaagrupada_turmaorigem (cost=0.00..4.23 rows=10 width=0) (actual time=0.002..0.002 rows=0 loops=4,669)

  • Index Cond: (turmaorigem = "*SELECT* 1".turma)
186. 0.000 0.000 ↓ 0.0 0 4,669

Bitmap Index Scan on gradecurriculargrupooptativadisciplina_pkey (cost=0.00..0.15 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=4,669)

  • Index Cond: (codigo = turmadisciplina.gradecurriculargrupooptativadisciplina)
187. 14.007 74.704 ↑ 1.0 1 4,669

Bitmap Heap Scan on gradedisciplina (cost=90.69..264.51 rows=1 width=12) (actual time=0.015..0.016 rows=1 loops=4,669)

  • Recheck Cond: ((codigo = (SubPlan 4)) OR (turmadisciplina.gradedisciplina = codigo))
  • Filter: (("*SELECT* 1".turmaagrupada AND (codigo = (SubPlan 4))) OR (turmadisciplina.gradedisciplina = codigo))
  • Heap Blocks: exact=4,656
188. 46.690 60.697 ↓ 0.0 0 4,669

BitmapOr (cost=90.69..90.69 rows=2 width=0) (actual time=0.013..0.013 rows=0 loops=4,669)

189. 0.000 0.000 ↓ 0.0 0 4,669

Bitmap Index Scan on gradedisciplina_pkey (cost=0.00..85.20 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=4,669)

  • Index Cond: (codigo = (SubPlan 4))
190.          

SubPlan (for Bitmap Index Scan)

191. 4.669 42.021 ↑ 1.0 1 4,669

Aggregate (cost=84.89..84.90 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=4,669)

192. 9.332 37.352 ↓ 0.0 0 4,669

Hash Join (cost=15.20..84.89 rows=1 width=4) (actual time=0.008..0.008 rows=0 loops=4,669)

  • Hash Cond: (td.turma = turmaagrupada.turma)
193. 0.006 0.006 ↑ 20.0 1 1

Index Scan using ch_turmadisciplina_disciplina on turmadisciplina td (cost=0.29..69.89 rows=20 width=8) (actual time=0.006..0.006 rows=1 loops=1)

  • Index Cond: (disciplina = "*SELECT* 1".disciplina)
194. 18.676 28.014 ↓ 0.0 0 4,669

Hash (cost=14.79..14.79 rows=10 width=4) (actual time=0.006..0.006 rows=0 loops=4,669)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
195. 4.669 9.338 ↓ 0.0 0 4,669

Bitmap Heap Scan on turmaagrupada (cost=4.23..14.79 rows=10 width=4) (actual time=0.002..0.002 rows=0 loops=4,669)

  • Recheck Cond: (turmaorigem = "*SELECT* 1".turma)
196. 4.669 4.669 ↓ 0.0 0 4,669

Bitmap Index Scan on idx_turmaagrupada_turmaorigem (cost=0.00..4.23 rows=10 width=0) (actual time=0.001..0.001 rows=0 loops=4,669)

  • Index Cond: (turmaorigem = "*SELECT* 1".turma)
197. 14.007 14.007 ↑ 1.0 1 4,669

Bitmap Index Scan on gradedisciplina_pkey (cost=0.00..0.29 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=4,669)

  • Index Cond: (codigo = turmadisciplina.gradedisciplina)
198. 4.669 144.739 ↓ 0.0 0 4,669

Bitmap Heap Scan on gradedisciplinacomposta (cost=523.44..1,573.73 rows=1 width=12) (actual time=0.031..0.031 rows=0 loops=4,669)

  • Recheck Cond: ((codigo = (SubPlan 6)) OR (codigo = (SubPlan 7)))
  • Filter: (("*SELECT* 1".turmaagrupada AND (codigo = (SubPlan 6))) OR (codigo = (SubPlan 7)))
199. 140.070 140.070 ↓ 0.0 0 4,669

BitmapOr (cost=523.44..523.44 rows=2 width=0) (actual time=0.030..0.030 rows=0 loops=4,669)

200. 0.000 0.000 ↓ 0.0 0 4,669

Bitmap Index Scan on gradedisciplinacomposta_pkey (cost=0.00..463.05 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=4,669)

  • Index Cond: (codigo = (SubPlan 6))
201.          

SubPlan (for Bitmap Index Scan)

202. 4.669 32.683 ↑ 1.0 1 4,669

Aggregate (cost=462.88..462.89 rows=1 width=4) (actual time=0.007..0.007 rows=1 loops=4,669)

203. 0.000 28.014 ↓ 0.0 0 4,669

Nested Loop (cost=4.52..462.88 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=4,669)

  • Join Filter: ((gdc.gradecurriculargrupooptativadisciplina = td_2.gradecurriculargrupooptativadisciplina) OR (gdc.gradedisciplina = td_2.gradedisciplina))
204. 18.676 28.014 ↓ 0.0 0 4,669

Nested Loop (cost=4.52..442.78 rows=174 width=8) (actual time=0.006..0.006 rows=0 loops=4,669)

205. 4.669 9.338 ↓ 0.0 0 4,669

Bitmap Heap Scan on turmaagrupada turmaagrupada_2 (cost=4.23..14.79 rows=10 width=4) (actual time=0.002..0.002 rows=0 loops=4,669)

  • Recheck Cond: (turmaorigem = "*SELECT* 1".turma)
206. 4.669 4.669 ↓ 0.0 0 4,669

Bitmap Index Scan on idx_turmaagrupada_turmaorigem (cost=0.00..4.23 rows=10 width=0) (actual time=0.001..0.001 rows=0 loops=4,669)

  • Index Cond: (turmaorigem = "*SELECT* 1".turma)
207. 0.000 0.000 ↓ 0.0 0

Index Scan using ch_turmadisciplina_turma on turmadisciplina td_2 (cost=0.29..42.63 rows=17 width=12) (never executed)

  • Index Cond: (turma = turmaagrupada_2.turma)
208. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.00..14.01 rows=2 width=12) (never executed)

209. 0.000 0.000 ↓ 0.0 0

Seq Scan on gradedisciplinacomposta gdc (cost=0.00..14.00 rows=2 width=12) (never executed)

  • Filter: (disciplina = "*SELECT* 1".disciplina)
210. 0.000 0.000 ↓ 0.0 0 4,669

Bitmap Index Scan on gradedisciplinacomposta_pkey (cost=0.00..60.40 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=4,669)

  • Index Cond: (codigo = (SubPlan 7))
211.          

SubPlan (for Bitmap Index Scan)

212. 46.690 98.049 ↓ 0.0 0 4,669

Nested Loop (cost=0.29..60.24 rows=1 width=4) (actual time=0.021..0.021 rows=0 loops=4,669)

  • Join Filter: ((gdc_1.gradecurriculargrupooptativadisciplina = td_3.gradecurriculargrupooptativadisciplina) OR (gdc_1.gradedisciplina = td_3.gradedisciplina))
213. 51.359 51.359 ↓ 1.1 19 4,669

Index Scan using ch_turmadisciplina_turma on turmadisciplina td_3 (cost=0.29..45.64 rows=17 width=8) (actual time=0.004..0.011 rows=19 loops=4,669)

  • Index Cond: (turma = "*SELECT* 1".turma)
214. 0.000 0.000 ↓ 0.0 0 87,575

Materialize (cost=0.00..14.01 rows=2 width=12) (actual time=0.000..0.000 rows=0 loops=87,575)

215. 0.000 0.000 ↓ 0.0 0 4,669

Seq Scan on gradedisciplinacomposta gdc_1 (cost=0.00..14.00 rows=2 width=12) (actual time=0.000..0.000 rows=0 loops=4,669)

  • Filter: (disciplina = "*SELECT* 1".disciplina)
216.          

SubPlan (for Nested Loop Left Join)

217. 42.021 1,097.215 ↑ 1.0 1 4,669

Aggregate (cost=41.02..41.03 rows=1 width=32) (actual time=0.234..0.235 rows=1 loops=4,669)

218. 1,055.194 1,055.194 ↑ 7.0 1 4,669

CTE Scan on cte_coordenador c_1 (cost=0.00..41.00 rows=7 width=218) (actual time=0.129..0.226 rows=1 loops=4,669)

  • Filter: (((curso = "*SELECT* 1".curso) AND (unidadeensino = "*SELECT* 1".unidadeensino) AND (turma IS NULL)) OR (turma = "*SELECT* 1".turma))
  • Rows Removed by Filter: 1,490
219. 28.014 1,260.630 ↑ 1.0 1 4,669

Aggregate (cost=44.75..44.76 rows=1 width=32) (actual time=0.270..0.270 rows=1 loops=4,669)

220. 1,232.616 1,232.616 ↑ 7.0 1 4,669

CTE Scan on cte_coordenador c_2 (cost=0.00..44.73 rows=7 width=218) (actual time=0.150..0.264 rows=1 loops=4,669)

  • Filter: (((email)::text <> ''::text) AND (((curso = "*SELECT* 1".curso) AND (unidadeensino = "*SELECT* 1".unidadeensino) AND (turma IS NULL)) OR (turma = "*SELECT* 1".turma)))
  • Rows Removed by Filter: 1,490
Planning time : 15.522 ms
Execution time : 7,896.813 ms