explain.depesz.com

PostgreSQL's explain analyze made readable

Result: a8Uz

Settings
# exclusive inclusive rows x rows loops node
1. 6.608 50,891.520 ↓ 159.0 159 1

Nested Loop (cost=4,267.65..69,359.37 rows=1 width=62) (actual time=21,094.997..50,891.520 rows=159 loops=1)

  • Join Filter: ((d.id_discente = mc.id_discente) AND (crc_comp.id_componente_curricular = mc.id_componente_curricular))
  • Rows Removed by Join Filter: 3483
2. 5,018.701 50,876.852 ↓ 403.0 403 1

Nested Loop (cost=4,267.65..69,354.24 rows=1 width=62) (actual time=20,952.929..50,876.852 rows=403 loops=1)

  • Join Filter: (ovs.id_oferta_vagas_sisu_ovs = cs.id_oferta_vagas_inscrito_sisu_cs)
  • Rows Removed by Join Filter: 1587548
3. 7,750.241 39,748.537 ↓ 2,036,538.0 2,036,538 1

Nested Loop (cost=4,267.65..69,353.55 rows=1 width=54) (actual time=19,212.683..39,748.537 rows=2,036,538 loops=1)

4. 4,869.455 25,888.682 ↓ 2,036,538.0 2,036,538 1

Hash Join (cost=4,267.65..69,352.81 rows=1 width=50) (actual time=19,212.654..25,888.682 rows=2,036,538 loops=1)

  • Hash Cond: ((movimentacao_aluno.id_discente = d.id_discente) AND ((max(movimentacao_aluno.data_ocorrencia)) = m.data_ocorrencia))
5. 853.227 1,918.846 ↓ 1.5 334,961 1

GroupAggregate (cost=0.00..61,131.27 rows=225,936 width=12) (actual time=0.023..1,918.846 rows=334,961 loops=1)

6. 1,065.619 1,065.619 ↑ 1.0 628,613 1

Index Scan using idx_movimentacao_aluno_id_discente_ano_periodo_ativo on movimentacao_aluno (cost=0.00..55,717.89 rows=630,803 width=12) (actual time=0.014..1,065.619 rows=628,613 loops=1)

  • Index Cond: (ativo = true)
  • Filter: ((data_retorno IS NULL) AND (ativo IS TRUE))
  • Rows Removed by Filter: 99750
7. 4,551.094 19,100.381 ↓ 159.1 3,439,728 1

Hash (cost=3,943.29..3,943.29 rows=21,624 width=54) (actual time=19,100.381..19,100.381 rows=3,439,728 loops=1)

  • Buckets: 4096 Batches: 32 (originally 1) Memory Usage: 16385kB
8. 6,069.620 14,549.287 ↓ 159.1 3,439,728 1

Merge Join (cost=156.26..3,943.29 rows=21,624 width=54) (actual time=2.436..14,549.287 rows=3,439,728 loops=1)

  • Merge Cond: (crc.id_matriz = ovs.id_matriz_curricular_ovs)
9. 1,539.104 5,812.820 ↓ 31.9 514,970 1

Nested Loop (cost=0.00..10,854.71 rows=16,155 width=50) (actual time=0.080..5,812.820 rows=514,970 loops=1)

10. 671.940 1,765.350 ↓ 44.0 418,061 1

Nested Loop (cost=0.00..4,176.24 rows=9,499 width=26) (actual time=0.066..1,765.350 rows=418,061 loops=1)

11. 2.684 15.024 ↓ 14.5 941 1

Nested Loop (cost=0.00..2,113.31 rows=65 width=16) (actual time=0.038..15.024 rows=941 loops=1)

12. 2.035 2.035 ↓ 2.0 229 1

Index Scan using idx_curriculo_id_matriz_btree on curriculo crc (cost=0.00..154.05 rows=116 width=8) (actual time=0.016..2.035 rows=229 loops=1)

  • Filter: ((vigente IS TRUE) AND (ativo IS TRUE))
  • Rows Removed by Filter: 1230
13. 10.305 10.305 ↓ 4.0 4 229

Index Scan using fki_id_curriculo_fk on curriculo_componente crc_comp (cost=0.00..16.88 rows=1 width=8) (actual time=0.011..0.045 rows=4 loops=229)

  • Index Cond: (id_curriculo = crc.id_curriculo)
  • Filter: ((obrigatoria IS TRUE) AND (semestre_oferta = 1))
  • Rows Removed by Filter: 55
14. 1,078.386 1,078.386 ↓ 2.5 444 941

Index Scan using idx_discente_id_curriculo_btree on discente d (cost=0.00..29.96 rows=178 width=22) (actual time=0.019..1.146 rows=444 loops=941)

  • Index Cond: (id_curriculo = crc_comp.id_curriculo)
  • Filter: (nivel = 'G'::bpchar)
  • Rows Removed by Filter: 13
15. 2,508.366 2,508.366 ↑ 2.0 1 418,061

Index Scan using idx_movimentacao_aluno_id_discente_ano_periodo_ativo on movimentacao_aluno m (cost=0.00..0.68 rows=2 width=24) (actual time=0.004..0.006 rows=1 loops=418,061)

  • Index Cond: ((id_discente = d.id_discente) AND (ativo = true))
  • Filter: ((data_retorno IS NULL) AND (ativo IS TRUE))
  • Rows Removed by Filter: 0
16. 2,665.494 2,666.847 ↓ 3,474.5 3,439,765 1

Sort (cost=156.26..158.73 rows=990 width=8) (actual time=2.349..2,666.847 rows=3,439,765 loops=1)

  • Sort Key: ovs.id_matriz_curricular_ovs
  • Sort Method: quicksort Memory: 71kB
17. 1.353 1.353 ↑ 1.0 990 1

Seq Scan on tb_oferta_vagas_sisu_ovs ovs (cost=0.00..107.00 rows=990 width=8) (actual time=0.102..1.353 rows=990 loops=1)

  • Filter: (id_edicao_sisu_ovs = 4)
  • Rows Removed by Filter: 2530
18. 6,109.614 6,109.614 ↑ 1.0 1 2,036,538

Index Scan using pessoa_pkey on pessoa p (cost=0.00..0.73 rows=1 width=12) (actual time=0.002..0.003 rows=1 loops=2,036,538)

  • Index Cond: (id_pessoa = d.id_pessoa)
19. 6,109.614 6,109.614 ↑ 2.0 1 2,036,538

Index Scan using idx_candidato_sisu_cs_cpf_opcao on tb_candidato_sisu_cs cs (cost=0.00..0.67 rows=2 width=24) (actual time=0.002..0.003 rows=1 loops=2,036,538)

  • Index Cond: (num_cpf_cs = p.cpf_cnpj)
20. 8.060 8.060 ↑ 5.2 9 403

Index Scan using turma_discente_sitmat on matricula_componente mc (cost=0.00..4.42 rows=47 width=16) (actual time=0.007..0.020 rows=9 loops=403)

  • Index Cond: ((id_discente = m.id_discente) AND (id_situacao_matricula = ANY ('{4,21,22,23}'::integer[])))
Total runtime : 50,892.021 ms