explain.depesz.com

PostgreSQL's explain analyze made readable

Result: EYHH

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 37,008.845 ↓ 6.0 6 1

Limit (cost=7,694.23..7,694.34 rows=1 width=631) (actual time=37,008.827..37,008.845 rows=6 loops=1)

2. 0.014 37,008.840 ↓ 6.0 6 1

Unique (cost=7,694.23..7,694.34 rows=1 width=631) (actual time=37,008.825..37,008.840 rows=6 loops=1)

3. 0.137 37,008.826 ↓ 6.0 6 1

Sort (cost=7,694.23..7,694.23 rows=1 width=631) (actual time=37,008.824..37,008.826 rows=6 loops=1)

  • Sort Key: ptf.in_prioridade DESC, ppe.id_processo_parte_expediente DESC, ptf.id_processo_trf, ptf.nr_processo, ptf.nr_sequencia, ptf.nr_ano, ptf.dt_distribuicao, ptf.nm_pessoa_autor, ptf.qt_autor, ptf.nm_pessoa_reu, ptf.qt_reu, ptf.id_orgao_julga
  • Sort Method: quicksort Memory: 29kB
4. 1.836 37,008.689 ↓ 8.0 8 1

Nested Loop Semi Join (cost=2.83..7,694.22 rows=1 width=631) (actual time=35,513.723..37,008.689 rows=8 loops=1)

5. 87.646 37,001.643 ↓ 521.0 521 1

Nested Loop (cost=2.41..7,678.17 rows=1 width=475) (actual time=3,215.724..37,001.643 rows=521 loops=1)

  • Join Filter: ((ppe.id_processo_parte_expediente)::integer = fcx_exp.id_processo_parte_expediente)
  • Rows Removed by Join Filter: 1163479
6. 5.087 271.277 ↓ 1,940.0 1,940 1

Nested Loop Left Join (cost=2.13..3,088.29 rows=1 width=475) (actual time=0.474..271.277 rows=1,940 loops=1)

7. 5.693 240.970 ↓ 1,940.0 1,940 1

Nested Loop (cost=1.71..3,080.05 rows=1 width=463) (actual time=0.447..240.970 rows=1,940 loops=1)

8. 41.454 217.817 ↓ 1,940.0 1,940 1

Nested Loop (cost=1.28..3,071.64 rows=1 width=437) (actual time=0.422..217.817 rows=1,940 loops=1)

  • Join Filter: ((pe.id_tipo_processo_documento)::integer = (tpd.id_tipo_processo_documento)::integer)
  • Rows Removed by Join Filter: 409340
9. 5.278 135.623 ↓ 1,940.0 1,940 1

Nested Loop (cost=1.28..3,063.87 rows=1 width=416) (actual time=0.393..135.623 rows=1,940 loops=1)

10. 7.837 89.605 ↓ 1,940.0 1,940 1

Nested Loop (cost=0.85..3,055.41 rows=1 width=402) (actual time=0.366..89.605 rows=1,940 loops=1)

11. 1.753 37.483 ↓ 23.1 2,605 1

Nested Loop (cost=0.43..2,104.00 rows=113 width=97) (actual time=0.121..37.483 rows=2,605 loops=1)

12. 0.001 0.001 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

13. 35.729 35.729 ↓ 23.1 2,605 1

Index Scan using tb_proc_parte_exp_idx_procur on tb_proc_parte_expediente ppe (cost=0.43..2,102.85 rows=113 width=97) (actual time=0.118..35.729 rows=2,605 loops=1)

  • Index Cond: ((id_procuradoria = 43) AND (in_fechado = true) AND (in_intima_pessoal = false) AND (in_intima_pessoal = false))
  • Filter: ((NOT in_intima_pessoal) AND in_fechado AND (id_resposta IS NOT NULL) AND (NOT in_intima_pessoal))
  • Rows Removed by Filter: 574
14. 44.285 44.285 ↑ 1.0 1 2,605

Index Scan using tb_cabecalho_processo_pkey on tb_cabecalho_processo ptf (cost=0.42..8.41 rows=1 width=309) (actual time=0.016..0.017 rows=1 loops=2,605)

  • Index Cond: ((id_processo_trf)::integer = (ppe.id_processo_trf)::integer)
  • Filter: ((id_jurisdicao)::integer = 15)
  • Rows Removed by Filter: 0
15. 40.740 40.740 ↑ 1.0 1 1,940

Index Scan using idx_tb_processo_expediente2 on tb_processo_expediente pe (cost=0.43..8.45 rows=1 width=18) (actual time=0.019..0.021 rows=1 loops=1,940)

  • Index Cond: ((id_processo_expediente)::integer = (ppe.id_processo_expediente)::integer)
16. 40.740 40.740 ↑ 1.0 212 1,940

Seq Scan on tb_tipo_processo_documento tpd (cost=0.00..5.12 rows=212 width=25) (actual time=0.004..0.021 rows=212 loops=1,940)

17. 17.460 17.460 ↑ 1.0 1 1,940

Index Scan using tb_usuario_pkey on tb_usuario_login ul (cost=0.42..8.41 rows=1 width=30) (actual time=0.008..0.009 rows=1 loops=1,940)

  • Index Cond: (id_usuario = (ppe.id_pessoa_parte)::integer)
18. 25.220 25.220 ↑ 1.0 1 1,940

Index Scan using pk_tb_resposta_expediente on tb_resposta_expediente rex (cost=0.42..8.23 rows=1 width=12) (actual time=0.012..0.013 rows=1 loops=1,940)

  • Index Cond: (id = ppe.id_resposta)
19. 131.920 36,642.720 ↑ 1.0 600 1,940

Nested Loop (cost=0.28..4,582.08 rows=624 width=4) (actual time=0.051..18.888 rows=600 loops=1,940)

20. 19.400 19.400 ↑ 1.0 1 1,940

Index Scan using tb_caixa_adv_proc_pkey on tb_caixa_adv_proc caixa (cost=0.28..8.30 rows=1 width=4) (actual time=0.008..0.010 rows=1 loops=1,940)

  • Index Cond: ((id_caixa_adv_proc)::integer = 543)
  • Filter: ((id_localizacao)::integer = 16547)
21. 36,491.400 36,491.400 ↑ 1.0 600 1,940

Seq Scan on tb_proc_parte_exp_caixa_adv_proc fcx_exp (cost=0.00..4,567.54 rows=624 width=8) (actual time=0.041..18.810 rows=600 loops=1,940)

  • Filter: (id_caixa_adv_proc = 543)
  • Rows Removed by Filter: 233837
22. 5.210 5.210 ↓ 0.0 0 521

Index Scan using pk_tb_resposta_expediente on tb_resposta_expediente (cost=0.42..8.24 rows=1 width=4) (actual time=0.010..0.010 rows=0 loops=521)

  • Index Cond: (id = ppe.id_resposta)
  • Filter: ((dt_registro >= '2019-04-30 00:00:00'::timestamp without time zone) AND (dt_registro <= now()))
  • Rows Removed by Filter: 1