explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VwFSI

Settings
# exclusive inclusive rows x rows loops node
1. 0.053 172.702 ↓ 73.0 73 1

GroupAggregate (cost=4,939.03..4,939.08 rows=1 width=234) (actual time=172.647..172.702 rows=73 loops=1)

  • Group Key: t0_.id_pessoa, t0_.no_pessoa, t0_.no_sobrenome, ch.no_cargo, ch.no_funcao, t2_.no_situacao_cadastro, t3_.sg_pais, t3_.no_pais, t4_.id_tipo_carteira, kk1.dt_alteracao, t7_.no_registro
2. 0.713 172.649 ↓ 136.0 136 1

Sort (cost=4,939.03..4,939.04 rows=1 width=234) (actual time=172.641..172.649 rows=136 loops=1)

  • Sort Key: t0_.id_pessoa, t0_.no_pessoa, t0_.no_sobrenome, ch.no_cargo, ch.no_funcao, t2_.no_situacao_cadastro, t3_.sg_pais, t3_.no_pais, t4_.id_tipo_carteira, kk1.dt_alteracao, t7_.no_registro
  • Sort Method: quicksort Memory: 51kB
3. 37.639 171.936 ↓ 136.0 136 1

Nested Loop Left Join (cost=4,419.77..4,939.02 rows=1 width=234) (actual time=31.651..171.936 rows=136 loops=1)

  • Join Filter: (t0_.id_pessoa = t8_.id_pessoa)
  • Rows Removed by Join Filter: 619,756
4. 15.270 38.825 ↓ 136.0 136 1

Hash Right Join (cost=1,441.19..1,833.95 rows=1 width=224) (actual time=22.292..38.825 rows=136 loops=1)

  • Hash Cond: (t5_.id_titular = t0_.id_pessoa)
  • Filter: (((t0_.no_registro_ascii)::text = '34.543-x'::text) OR ((t5_.no_registro_ascii)::text = '34.543-x'::text) OR ((((t0_.no_pessoa_ascii)::text || ' '::text) || (t0_.no_sobrenome_ascii)::text) = 'lcdi'::text) OR ((((t5_.no_pessoa_as (...)
  • Rows Removed by Filter: 3,518
5. 1.534 1.534 ↑ 1.0 4,739 1

Seq Scan on tb_pessoa t5_ (cost=0.00..374.43 rows=4,739 width=39) (actual time=0.050..1.534 rows=4,739 loops=1)

  • Filter: in_ativo
  • Rows Removed by Filter: 204
6. 1.673 22.021 ↓ 128.8 2,448 1

Hash (cost=1,440.95..1,440.95 rows=19 width=251) (actual time=22.021..22.021 rows=2,448 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 417kB
7. 0.595 20.348 ↓ 128.8 2,448 1

Hash Left Join (cost=1,307.18..1,440.95 rows=19 width=251) (actual time=6.533..20.348 rows=2,448 loops=1)

  • Hash Cond: (t0_.id_pessoa = kk1.id_pessoa)
8. 0.158 16.603 ↓ 128.8 2,448 1

Nested Loop Left Join (cost=255.42..389.10 rows=19 width=243) (actual time=3.369..16.603 rows=2,448 loops=1)

9. 0.790 13.997 ↓ 128.8 2,448 1

Nested Loop Left Join (cost=255.27..385.37 rows=19 width=233) (actual time=3.365..13.997 rows=2,448 loops=1)

10. 0.765 10.759 ↓ 128.8 2,448 1

Hash Join (cost=255.00..379.16 rows=19 width=233) (actual time=3.355..10.759 rows=2,448 loops=1)

  • Hash Cond: (t0_.id_situacao_cadastro = t2_.id_situacao_cadastro)
  • Join Filter: ((t2_.id_situacao_cadastro <> ALL ('{1,2,4,5,6}'::integer[])) OR ((t2_.id_situacao_cadastro = ANY ('{2,4,5,6}'::integer[])) AND (hashed SubPlan 1)))
  • Rows Removed by Join Filter: 4
11. 0.000 9.976 ↓ 79.7 2,470 1

Nested Loop (cost=252.60..376.13 rows=31 width=119) (actual time=3.334..9.976 rows=2,470 loops=1)

12. 1.267 5.212 ↓ 40.1 2,487 1

Hash Join (cost=252.32..321.41 rows=62 width=52) (actual time=3.326..5.212 rows=2,487 loops=1)

  • Hash Cond: ((tb_chegada.id_pessoa = ch.id_pessoa) AND ((max(tb_chegada.dt_chegada)) = ch.dt_chegada))
13. 1.250 1.568 ↑ 1.0 2,512 1

HashAggregate (cost=80.94..106.06 rows=2,512 width=8) (actual time=0.932..1.568 rows=2,512 loops=1)

  • Group Key: tb_chegada.id_pessoa
14. 0.318 0.318 ↑ 1.0 2,529 1

Seq Scan on tb_chegada (cost=0.00..68.29 rows=2,529 width=8) (actual time=0.004..0.318 rows=2,529 loops=1)

15. 0.479 2.377 ↓ 10.0 2,489 1

Hash (cost=167.65..167.65 rows=249 width=52) (actual time=2.377..2.377 rows=2,489 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 201kB
16. 0.563 1.898 ↓ 10.0 2,497 1

Hash Join (cost=87.48..167.65 rows=249 width=52) (actual time=0.978..1.898 rows=2,497 loops=1)

  • Hash Cond: (ch.id_chegada = t10_.id_chegada)
17. 0.369 0.369 ↑ 1.0 2,505 1

Seq Scan on tb_chegada ch (cost=0.00..68.29 rows=2,505 width=52) (actual time=0.004..0.369 rows=2,505 loops=1)

  • Filter: in_ativo
  • Rows Removed by Filter: 24
18. 0.296 0.966 ↓ 10.0 2,515 1

Hash (cost=84.34..84.34 rows=251 width=8) (actual time=0.966..0.966 rows=2,515 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 99kB
19. 0.448 0.670 ↓ 10.0 2,515 1

Hash Join (cost=4.06..84.34 rows=251 width=8) (actual time=0.058..0.670 rows=2,515 loops=1)

  • Hash Cond: (t10_.id_categoria_funcional = t13_.id_categoria_funcional)
20. 0.176 0.176 ↑ 1.0 2,529 1

Seq Scan on tb_chegada t10_ (cost=0.00..68.29 rows=2,529 width=12) (actual time=0.002..0.176 rows=2,529 loops=1)

21. 0.002 0.046 ↓ 10.0 30 1

Hash (cost=4.02..4.02 rows=3 width=12) (actual time=0.046..0.046 rows=30 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 2kB
22. 0.013 0.044 ↓ 10.0 30 1

Hash Join (cost=2.58..4.02 rows=3 width=12) (actual time=0.037..0.044 rows=30 loops=1)

  • Hash Cond: (t12_.id_categoria_funcional = t13_.id_categoria_funcional)
23. 0.003 0.003 ↑ 1.0 30 1

Seq Scan on tb_categoria_funcional t12_ (cost=0.00..1.30 rows=30 width=4) (actual time=0.002..0.003 rows=30 loops=1)

24. 0.005 0.028 ↓ 10.0 30 1

Hash (cost=2.54..2.54 rows=3 width=8) (actual time=0.028..0.028 rows=30 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 2kB
25. 0.011 0.023 ↓ 10.0 30 1

Hash Join (cost=1.10..2.54 rows=3 width=8) (actual time=0.014..0.023 rows=30 loops=1)

  • Hash Cond: (t13_.id_tipo_carteira = t4_.id_tipo_carteira)
26. 0.007 0.007 ↑ 1.0 30 1

Seq Scan on tb_tipo_carteira_categoria t13_ (cost=0.00..1.30 rows=30 width=8) (actual time=0.002..0.007 rows=30 loops=1)

27. 0.000 0.005 ↓ 2.0 6 1

Hash (cost=1.06..1.06 rows=3 width=4) (actual time=0.005..0.005 rows=6 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
28. 0.005 0.005 ↓ 2.0 6 1

Seq Scan on tb_tipo_carteira t4_ (cost=0.00..1.06 rows=3 width=4) (actual time=0.003..0.005 rows=6 loops=1)

  • Filter: in_ativo
29. 4.974 4.974 ↑ 1.0 1 2,487

Index Scan using pk_tb_pessoa on tb_pessoa t0_ (cost=0.28..0.87 rows=1 width=75) (actual time=0.001..0.002 rows=1 loops=2,487)

  • Index Cond: (id_pessoa = ch.id_pessoa)
  • Filter: (in_ativo AND (id_titular IS NULL))
  • Rows Removed by Filter: 0
30. 0.001 0.014 ↓ 1.3 9 1

Hash (cost=1.21..1.21 rows=7 width=122) (actual time=0.014..0.014 rows=9 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
31. 0.013 0.013 ↓ 1.3 9 1

Seq Scan on tb_situacao_cadastro t2_ (cost=0.00..1.21 rows=7 width=122) (actual time=0.009..0.013 rows=9 loops=1)

  • Filter: ((id_situacao_cadastro <> ALL ('{1,2,4,5,6}'::integer[])) OR (id_situacao_cadastro = ANY ('{2,4,5,6}'::integer[])))
  • Rows Removed by Filter: 1
32.          

SubPlan (for Hash Join)

33. 0.004 0.004 ↓ 4.0 4 1

Seq Scan on tb_unidade_administrativa_tipo_solicitacao t14_ (cost=0.00..1.09 rows=1 width=4) (actual time=0.003..0.004 rows=4 loops=1)

  • Filter: ((id_unidade_administrativa = 71) AND (id_tipo_solicitacao = 1))
  • Rows Removed by Filter: 2
34. 2.448 2.448 ↑ 1.0 1 2,448

Index Scan using pk_tb_organizacao on tb_organizacao t9_ (cost=0.28..0.32 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=2,448)

  • Index Cond: (id_organizacao = t0_.id_organizacao)
35. 2.448 2.448 ↑ 1.0 1 2,448

Index Scan using idx_id_pais on tb_pais t3_ (cost=0.14..0.19 rows=1 width=18) (actual time=0.001..0.001 rows=1 loops=2,448)

  • Index Cond: (id_pais = t9_.id_pais)
36. 0.000 3.150 ↓ 0.0 0 1

Hash (cost=1,051.75..1,051.75 rows=1 width=12) (actual time=3.150..3.150 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 0kB
37. 0.002 3.150 ↓ 0.0 0 1

Subquery Scan on kk1 (cost=1,051.73..1,051.75 rows=1 width=12) (actual time=3.150..3.150 rows=0 loops=1)

38. 0.000 3.148 ↓ 0.0 0 1

Unique (cost=1,051.73..1,051.74 rows=1 width=12) (actual time=3.148..3.148 rows=0 loops=1)

39. 0.007 3.148 ↓ 0.0 0 1

Sort (cost=1,051.73..1,051.74 rows=1 width=12) (actual time=3.148..3.148 rows=0 loops=1)

  • Sort Key: t6_.id_pessoa, t6_.dt_alteracao
  • Sort Method: quicksort Memory: 25kB
40. 3.141 3.141 ↓ 0.0 0 1

Seq Scan on tb_historico_situacao_cadastro t6_ (cost=0.00..1,051.72 rows=1 width=12) (actual time=3.141..3.141 rows=0 loops=1)

  • Filter: (id_situacao_cadastro = 7)
  • Rows Removed by Filter: 16,298
41. 61.880 95.472 ↑ 1.0 4,558 136

Unique (cost=2,978.59..3,002.52 rows=4,558 width=22) (actual time=0.068..0.702 rows=4,558 loops=136)

42. 25.622 33.592 ↑ 1.0 4,786 136

Sort (cost=2,978.59..2,990.55 rows=4,786 width=22) (actual time=0.068..0.247 rows=4,786 loops=136)

  • Sort Key: t8_.id_pessoa, t7_.dt_expedicao
  • Sort Method: quicksort Memory: 566kB
43. 3.834 7.970 ↑ 1.0 4,786 1

Hash Right Join (cost=380.70..2,686.05 rows=4,786 width=22) (actual time=2.791..7.970 rows=4,786 loops=1)

  • Hash Cond: (t7_.id_solicitacao = t8_.id_solicitacao)
44. 2.002 2.002 ↑ 1.0 4,778 1

Seq Scan on tb_solicitacao_recibo t7_ (cost=0.00..2,215.78 rows=4,778 width=34) (actual time=0.646..2.002 rows=4,778 loops=1)

45. 0.641 2.134 ↑ 1.0 4,786 1

Hash (cost=320.88..320.88 rows=4,786 width=20) (actual time=2.134..2.134 rows=4,786 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 244kB
46. 1.493 1.493 ↑ 1.0 4,786 1

Seq Scan on tb_solicitacao t8_ (cost=0.00..320.88 rows=4,786 width=20) (actual time=0.012..1.493 rows=4,786 loops=1)

  • Filter: in_ativo
  • Rows Removed by Filter: 2
Planning time : 2.491 ms
Execution time : 173.025 ms