explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HZuK

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 18,945.891 ↑ 1.0 1 1

Limit (cost=49,110.14..49,110.25 rows=1 width=347) (actual time=18,945.890..18,945.891 rows=1 loops=1)

2. 0.003 18,945.889 ↑ 25,490.0 1 1

Unique (cost=49,110.14..52,041.49 rows=25,490 width=347) (actual time=18,945.889..18,945.889 rows=1 loops=1)

3. 596.976 18,945.886 ↑ 25,490.0 1 1

Sort (cost=49,110.14..49,173.86 rows=25,490 width=347) (actual time=18,945.886..18,945.886 rows=1 loops=1)

  • Sort Key: arquivo.dataupload DESC, arquivo.codigo, arquivo.codorigem, arquivo.nome, arquivo.apresentarportalcoordenador, arquivo.apresentarportalprofessor, arquivo.apresentarportalaluno, arquivo.descricao, arquivo.descricaoarquivo, arquivo.datadisponibilizacao, arquivo.dataindisponibilizacao, arquivo.manterdisponibilizacao, arquivo.controlardownload, arquivo.responsavelupload, arquivo.disciplina, arquivo.turma, arquivo.extensao, arquivo.apresentardeterminadoperiodo, arquivo.permitirarquivoresposta, arquivo.pastabasearquivo, arquivo.arquivoresposta, arquivo.professor, arquivo.niveleducacional, arquivo.cpfalunodocumentacao, arquivo.cpfrequerimento, arquivo.servidorarquivoonline, arquivo.indice, arquivo.agrupador, arquivo.indiceagrupador, arquivo.arquivoassinadodigitalmente, disciplina.codigo, disciplina.nome, turma.codigo, turma.identificadorturma, usuario.codigo, usuario.nome, professor.codigo, professor.nome, pessoa.codigo, pessoa.nome, curso.codigo, curso.nome, arquivo.arquivoassinadofuncionario, arquivo.arquivoassinadounidadeensino, arquivo.arquivoassinadounidadecertificadora
  • Sort Method: quicksort Memory: 24387kB
4. 7,389.643 18,348.910 ↓ 1.9 47,228 1

Gather (cost=22,939.72..47,244.57 rows=25,490 width=347) (actual time=2,410.794..18,348.910 rows=47,228 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
5. 8.996 10,959.267 ↓ 1.5 15,743 3 / 3

Hash Left Join (cost=21,939.72..43,695.57 rows=10,621 width=347) (actual time=2,418.082..10,959.267 rows=15,743 loops=3)

  • Hash Cond: (arquivo.curso = curso.codigo)
6. 7.568 10,950.218 ↓ 1.5 15,743 3 / 3

Parallel Hash Left Join (cost=21,936.22..43,663.52 rows=10,621 width=323) (actual time=2,418.013..10,950.218 rows=15,743 loops=3)

  • Hash Cond: (arquivo.pessoa = pessoa.codigo)
7. 7.590 10,886.465 ↓ 1.5 15,743 3 / 3

Parallel Hash Left Join (cost=15,971.04..37,670.46 rows=10,621 width=301) (actual time=2,360.668..10,886.465 rows=15,743 loops=3)

  • Hash Cond: (arquivo.professor = professor.codigo)
8. 9.009 10,840.875 ↓ 1.5 15,743 3 / 3

Hash Left Join (cost=10,005.86..31,677.40 rows=10,621 width=271) (actual time=2,321.306..10,840.875 rows=15,743 loops=3)

  • Hash Cond: (arquivo.responsavelupload = usuario.codigo)
9. 2,553.386 10,818.183 ↓ 1.5 15,743 3 / 3

Hash Join (cost=8,501.16..30,144.82 rows=10,621 width=240) (actual time=2,307.487..10,818.183 rows=15,743 loops=3)

  • Hash Cond: (t.curso = c.codigo)
  • Join Filter: ((((arquivo.niveleducacional)::text = (c.niveleducacional)::text) AND (arquivo.curso IS NULL) AND (arquivo.turma IS NULL) AND (arquivo.disciplina IS NULL)) OR ((arquivo.curso = t.curso) AND (arquivo.turma IS NULL) AND (arquivo.disciplina IS NULL)) OR ((arquivo.curso = t.curso) AND (arquivo.turma = ht.turma) AND (arquivo.disciplina IS NULL)) OR ((arquivo.curso = t.curso) AND (arquivo.turma IS NULL) AND (arquivo.disciplina = htdi.disciplina)) OR ((arquivo.curso IS NULL) AND (arquivo.turma = ht.turma) AND (arquivo.disciplina = htdi.disciplina)) OR ((arquivo.curso IS NULL) AND (arquivo.turma = ht.turma) AND (arquivo.disciplina IS NULL)) OR ((arquivo.curso IS NULL) AND (arquivo.turma IS NULL) AND (arquivo.disciplina = htdi.disciplina)))
  • Rows Removed by Join Filter: 6292591
10. 5,968.904 8,264.333 ↓ 5.1 6,308,334 3 / 3

Hash Join (cost=8,497.65..26,864.94 rows=1,245,979 width=252) (actual time=2,306.112..8,264.333 rows=6,308,334 loops=3)

  • Hash Cond: (htd.horarioturma = ht.codigo)
11. 2.245 14.709 ↑ 1.3 1,779 3 / 3

Parallel Hash Join (cost=2,324.89..6,671.83 rows=2,265 width=8) (actual time=11.544..14.709 rows=1,779 loops=3)

  • Hash Cond: (htdi.horarioturmadia = htd.codigo)
12. 1.852 1.992 ↑ 1.3 1,779 3 / 3

Parallel Bitmap Heap Scan on horarioturmadiaitem htdi (cost=102.56..4,443.56 rows=2,265 width=8) (actual time=0.518..1.992 rows=1,779 loops=3)

  • Recheck Cond: (professor = 119425)
  • Heap Blocks: exact=131
13. 0.140 0.140 ↑ 1.0 5,337 1 / 3

Bitmap Index Scan on idx_horturdiaitem_professor (cost=0.00..101.20 rows=5,437 width=0) (actual time=0.420..0.420 rows=5,337 loops=1)

  • Index Cond: (professor = 119425)
14. 5.612 10.472 ↑ 1.8 24,790 3 / 3

Parallel Hash (cost=1,675.48..1,675.48 rows=43,748 width=8) (actual time=10.471..10.472 rows=24,790 loops=3)

  • Buckets: 131072 Batches: 1 Memory Usage: 3968kB
15. 4.860 4.860 ↑ 1.8 24,790 3 / 3

Parallel Seq Scan on horarioturmadia htd (cost=0.00..1,675.48 rows=43,748 width=8) (actual time=0.010..4.860 rows=24,790 loops=3)

16. 1,706.218 2,280.720 ↓ 6.4 1,404,216 3 / 3

Hash (cost=3,450.26..3,450.26 rows=217,800 width=252) (actual time=2,280.720..2,280.720 rows=1,404,216 loops=3)

  • Buckets: 262144 (originally 262144) Batches: 8 (originally 1) Memory Usage: 63489kB
17. 470.056 574.502 ↓ 6.4 1,404,216 3 / 3

Nested Loop (cost=274.29..3,450.26 rows=217,800 width=252) (actual time=3.808..574.502 rows=1,404,216 loops=3)

18. 2.854 19.342 ↓ 6.4 3,546 3 / 3

Hash Left Join (cost=261.38..566.70 rows=550 width=240) (actual time=3.362..19.342 rows=3,546 loops=3)

  • Hash Cond: (arquivo.turma = turma.codigo)
19. 2.422 14.630 ↓ 6.4 3,546 3 / 3

Hash Left Join (cost=87.07..390.95 rows=550 width=216) (actual time=1.460..14.630 rows=3,546 loops=3)

  • Hash Cond: (arquivo.disciplina = disciplina.codigo)
20. 10.882 10.882 ↓ 6.4 3,546 3 / 3

Index Scan using ch_arquivo_situacao on arquivo (cost=0.29..302.72 rows=550 width=205) (actual time=0.102..10.882 rows=3,546 loops=3)

  • Index Cond: ((situacao)::text = 'AT'::text)
  • Filter: ((professor IS NULL) AND apresentarportalprofessor AND ((niveleducacional)::text <> ''::text) AND ((origem)::text = 'IN'::text))
  • Rows Removed by Filter: 368
21. 0.442 1.326 ↑ 1.0 2,746 3 / 3

Hash (cost=52.46..52.46 rows=2,746 width=23) (actual time=1.326..1.326 rows=2,746 loops=3)

  • Buckets: 4096 Batches: 1 Memory Usage: 181kB
22. 0.884 0.884 ↑ 1.0 2,746 3 / 3

Seq Scan on disciplina (cost=0.00..52.46 rows=2,746 width=23) (actual time=0.471..0.884 rows=2,746 loops=3)

23. 0.668 1.858 ↑ 1.0 4,147 3 / 3

Hash (cost=122.47..122.47 rows=4,147 width=24) (actual time=1.858..1.858 rows=4,147 loops=3)

  • Buckets: 8192 Batches: 1 Memory Usage: 294kB
24. 1.190 1.190 ↑ 1.0 4,147 3 / 3

Seq Scan on turma (cost=0.00..122.47 rows=4,147 width=24) (actual time=0.247..1.190 rows=4,147 loops=3)

25. 83.610 85.104 ↑ 1.0 396 10,638 / 3

Materialize (cost=12.91..162.06 rows=396 width=12) (actual time=0.000..0.024 rows=396 loops=10,638)

26. 0.799 1.494 ↑ 1.0 396 3 / 3

Hash Join (cost=12.91..160.08 rows=396 width=12) (actual time=0.437..1.494 rows=396 loops=3)

  • Hash Cond: (t.codigo = ht.turma)
27. 0.280 0.280 ↑ 1.0 4,147 3 / 3

Seq Scan on turma t (cost=0.00..122.47 rows=4,147 width=8) (actual time=0.008..0.280 rows=4,147 loops=3)

28. 0.061 0.415 ↑ 1.0 396 3 / 3

Hash (cost=7.96..7.96 rows=396 width=8) (actual time=0.415..0.415 rows=396 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 24kB
29. 0.354 0.354 ↑ 1.0 396 3 / 3

Seq Scan on horarioturma ht (cost=0.00..7.96 rows=396 width=8) (actual time=0.299..0.354 rows=396 loops=3)

30. 0.015 0.464 ↑ 1.0 67 3 / 3

Hash (cost=2.67..2.67 rows=67 width=7) (actual time=0.464..0.464 rows=67 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
31. 0.449 0.449 ↑ 1.0 67 3 / 3

Seq Scan on curso c (cost=0.00..2.67 rows=67 width=7) (actual time=0.430..0.449 rows=67 loops=3)

32. 5.799 13.683 ↑ 1.0 31,720 3 / 3

Hash (cost=1,108.20..1,108.20 rows=31,720 width=31) (actual time=13.683..13.683 rows=31,720 loops=3)

  • Buckets: 32768 Batches: 1 Memory Usage: 2213kB
33. 7.884 7.884 ↑ 1.0 31,720 3 / 3

Seq Scan on usuario (cost=0.00..1,108.20 rows=31,720 width=31) (actual time=0.398..7.884 rows=31,720 loops=3)

34. 17.206 38.000 ↑ 1.2 47,544 3 / 3

Parallel Hash (cost=5,222.30..5,222.30 rows=59,430 width=30) (actual time=38.000..38.000 rows=47,544 loops=3)

  • Buckets: 262144 Batches: 1 Memory Usage: 11296kB
35. 20.794 20.794 ↑ 1.2 47,544 3 / 3

Parallel Seq Scan on pessoa professor (cost=0.00..5,222.30 rows=59,430 width=30) (actual time=0.013..20.794 rows=47,544 loops=3)

36. 14.756 56.185 ↑ 1.2 47,544 3 / 3

Parallel Hash (cost=5,222.30..5,222.30 rows=59,430 width=30) (actual time=56.185..56.185 rows=47,544 loops=3)

  • Buckets: 262144 Batches: 1 Memory Usage: 11296kB
37. 41.429 41.429 ↑ 1.2 47,544 3 / 3

Parallel Seq Scan on pessoa (cost=0.00..5,222.30 rows=59,430 width=30) (actual time=0.413..41.429 rows=47,544 loops=3)

38. 0.015 0.053 ↑ 1.0 67 3 / 3

Hash (cost=2.67..2.67 rows=67 width=21) (actual time=0.053..0.053 rows=67 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
39. 0.038 0.038 ↑ 1.0 67 3 / 3

Seq Scan on curso (cost=0.00..2.67 rows=67 width=21) (actual time=0.021..0.038 rows=67 loops=3)

Planning time : 28.951 ms
Execution time : 18,956.860 ms