explain.depesz.com

PostgreSQL's explain analyze made readable

Result: cCPQ : demos

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 8,240.662 ↑ 1.0 1 1

Aggregate (cost=55,960.59..55,960.60 rows=1 width=0) (actual time=8,240.662..8,240.662 rows=1 loops=1)

2. 0.025 8,240.659 ↓ 0.0 0 1

HashAggregate (cost=55,956.11..55,958.10 rows=199 width=216) (actual time=8,240.659..8,240.659 rows=0 loops=1)

  • Group Key: processo_eletronico_processo.id, processo_eletronico_processo.numero_protocolo, processo_eletronico_processo.numero_protocolo_fisico, processo_eletronico_processo.tipo_processo_id, processo_eletronico_processo.assunto, processo_eletronico_processo.nivel_acesso, processo_eletronico_processo.hipotese_legal_id, processo_eletronico_processo.status, processo_eletronico_processo.data_hora_criacao, processo_eletronico_processo.usuario_gerador_id, processo_eletronico_processo.setor_criacao_id, processo_eletronico_processo.modificado_por_id, processo_eletronico_processo.ultima_modificacao, processo_eletronico_processo.ultimo_tramite_id, processo_eletronico_processo.setor_atual_id, processo_eletronico_processo.data_finalizacao, processo_eletronico_processo.usuario_finalizacao_id, processo_eletronico_processo.observacao_finalizacao
3. 0.025 8,240.634 ↓ 0.0 0 1

Hash Left Join (cost=26,549.76..55,947.16 rows=199 width=216) (actual time=8,240.634..8,240.634 rows=0 loops=1)

  • Hash Cond: (t7.id = t9.pessoa_ptr_id)
  • Filter: ((upper((processo_eletronico_processo.numero_protocolo)::text) ~~ 'DEMO'::text) OR (upper((processo_eletronico_processo.numero_protocolo_fisico)::text) ~~ 'DEMO'::text) OR (upper((processo_eletronico_processo.assunto)::text) ~~ 'DEMO'::text) OR (f_unaccent((t7.nome)::text) ~~ 'DEMO'::text) OR (upper((t8.cpf)::text) ~~ 'DEMO'::text) OR (upper((t8.username)::text) ~~ 'DEMO'::text) OR (upper((t9.cnpj)::text) ~~ 'DEMO'::text))
4. 0.000 8,240.609 ↓ 0.0 0 1

Nested Loop Left Join (cost=25,960.31..55,104.73 rows=6,720 width=268) (actual time=8,240.609..8,240.609 rows=0 loops=1)

5. 0.002 8,240.609 ↓ 0.0 0 1

Nested Loop Left Join (cost=25,959.89..51,613.32 rows=6,720 width=246) (actual time=8,240.609..8,240.609 rows=0 loops=1)

6. 0.000 8,240.607 ↓ 0.0 0 1

Nested Loop Left Join (cost=25,959.47..47,679.24 rows=6,720 width=220) (actual time=8,240.607..8,240.607 rows=0 loops=1)

7. 5,603.016 8,240.607 ↓ 0.0 0 1

Hash Left Join (cost=25,959.05..45,089.32 rows=4,990 width=216) (actual time=8,240.607..8,240.607 rows=0 loops=1)

  • Hash Cond: (pessoa.id = pessoa_juridica.pessoa_ptr_id)
  • Filter: ((upper((processo_eletronico_processo.numero_protocolo)::text) ~~ 'DEMO'::text) OR (upper((processo_eletronico_processo.numero_protocolo_fisico)::text) ~~ 'DEMO'::text) OR (upper((processo_eletronico_processo.assunto)::text) ~~ 'DEMO'::text) OR (f_unaccent((pessoa.nome)::text) ~~ 'DEMO'::text) OR (upper((pessoa_fisica.cpf)::text) ~~ 'DEMO'::text) OR (upper((pessoa_fisica.username)::text) ~~ 'DEMO'::text) OR (upper((pessoa_juridica.cnpj)::text) ~~ 'DEMO'::text))
  • Rows Removed by Filter: 168,378
8. 867.360 2,622.154 ↑ 1.0 168,378 1

Hash Right Join (cost=25,369.61..38,162.51 rows=168,378 width=268) (actual time=1,050.714..2,622.154 rows=168,378 loops=1)

  • Hash Cond: (processo_eletronico_processo_interessados.processo_id = processo_eletronico_processo.id)
9. 631.746 1,493.539 ↑ 1.0 168,378 1

Hash Right Join (cost=18,590.54..27,594.94 rows=168,378 width=56) (actual time=789.419..1,493.539 rows=168,378 loops=1)

  • Hash Cond: (pessoa_fisica.pessoa_ptr_id = pessoa.id)
10. 72.962 72.962 ↑ 1.0 209,382 1

Seq Scan on pessoa_fisica (cost=0.00..5,627.82 rows=209,382 width=26) (actual time=0.005..72.962 rows=209,382 loops=1)

11. 112.259 788.831 ↑ 1.0 168,378 1

Hash (cost=16,485.82..16,485.82 rows=168,378 width=34) (actual time=788.831..788.831 rows=168,378 loops=1)

  • Buckets: 32,768 Batches: 1 Memory Usage: 11,061kB
12. 378.542 676.572 ↑ 1.0 168,378 1

Hash Left Join (cost=10,313.01..16,485.82 rows=168,378 width=34) (actual time=250.700..676.572 rows=168,378 loops=1)

  • Hash Cond: (processo_eletronico_processo_interessados.pessoa_id = pessoa.id)
13. 47.435 47.435 ↑ 1.0 168,378 1

Seq Scan on processo_eletronico_processo_interessados (cost=0.00..2,594.78 rows=168,378 width=8) (actual time=0.030..47.435 rows=168,378 loops=1)

14. 134.217 250.595 ↑ 1.0 228,267 1

Hash (cost=7,459.67..7,459.67 rows=228,267 width=30) (actual time=250.595..250.595 rows=228,267 loops=1)

  • Buckets: 32,768 Batches: 1 Memory Usage: 13,960kB
15. 116.378 116.378 ↑ 1.0 228,267 1

Seq Scan on pessoa (cost=0.00..7,459.67 rows=228,267 width=30) (actual time=0.004..116.378 rows=228,267 loops=1)

16. 141.711 261.255 ↑ 1.0 125,025 1

Hash (cost=5,216.25..5,216.25 rows=125,025 width=216) (actual time=261.255..261.255 rows=125,025 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 31,712kB
17. 119.544 119.544 ↑ 1.0 125,025 1

Seq Scan on processo_eletronico_processo (cost=0.00..5,216.25 rows=125,025 width=216) (actual time=0.033..119.544 rows=125,025 loops=1)

18. 8.727 15.437 ↑ 1.0 18,642 1

Hash (cost=356.42..356.42 rows=18,642 width=17) (actual time=15.437..15.437 rows=18,642 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 908kB
19. 6.710 6.710 ↑ 1.0 18,642 1

Seq Scan on pessoa_juridica (cost=0.00..356.42 rows=18,642 width=17) (actual time=0.005..6.710 rows=18,642 loops=1)

20. 0.000 0.000 ↓ 0.0 0

Index Scan using processo_eletronico_processo_interessados_ff248c2d on processo_eletronico_processo_interessados t6 (cost=0.42..0.50 rows=2 width=8) (never executed)

  • Index Cond: (processo_eletronico_processo.id = processo_id)
21. 0.000 0.000 ↓ 0.0 0

Index Scan using pessoa_pkey on pessoa t7 (cost=0.42..0.58 rows=1 width=30) (never executed)

  • Index Cond: (t6.pessoa_id = id)
22. 0.000 0.000 ↓ 0.0 0

Index Scan using pessoa_fisica_pkey on pessoa_fisica t8 (cost=0.42..0.51 rows=1 width=26) (never executed)

  • Index Cond: (t7.id = pessoa_ptr_id)
23. 0.000 0.000 ↓ 0.0 0

Hash (cost=356.42..356.42 rows=18642 width=17) (never executed)" -> Seq Scan on pessoa_juridica t9 (cost=0.00..356.42 rows=18,642 width=17) (never executed)