explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jo9a : Optimization for: Optimization for: plan #R74U; plan #oFvV

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 179.390 2,883.394 ↓ 1.0 30,446 1

Hash Left Join (cost=71,251.99..3,443,052.45 rows=29,973 width=677) (actual time=648.674..2,883.394 rows=30,446 loops=1)

  • Hash Cond: (c.codigo = laudo.codigo_comunicacao_perda)
2. 141.024 1,653.330 ↓ 1.0 30,446 1

Hash Join (cost=66,945.61..199,375.32 rows=29,973 width=572) (actual time=602.482..1,653.330 rows=30,446 loops=1)

  • Hash Cond: (c.codigo_usuario_solicitacao = usuario.codigo)
3. 14.987 1,153.728 ↓ 1.0 30,446 1

Hash Join (cost=38,008.82..161,616.40 rows=29,973 width=553) (actual time=243.820..1,153.728 rows=30,446 loops=1)

  • Hash Cond: (p.codigo_safra = safra.codigo)
4. 26.616 1,138.725 ↓ 1.0 30,446 1

Nested Loop (cost=38,006.59..161,202.05 rows=29,973 width=549) (actual time=243.789..1,138.725 rows=30,446 loops=1)

5. 16.908 990.325 ↓ 1.0 30,446 1

Nested Loop (cost=38,006.17..144,147.60 rows=29,973 width=526) (actual time=243.778..990.325 rows=30,446 loops=1)

6. 14.726 851.633 ↓ 1.0 30,446 1

Hash Join (cost=38,005.75..128,992.51 rows=29,973 width=526) (actual time=243.771..851.633 rows=30,446 loops=1)

  • Hash Cond: (p.codigo_modelo = modelo.codigo)
7. 14.786 833.472 ↓ 1.0 30,446 1

Hash Join (cost=37,506.27..128,080.91 rows=29,973 width=275) (actual time=240.331..833.472 rows=30,446 loops=1)

  • Hash Cond: (p.codigo_cooperativa = empresa_cresol.codigo)
8. 16.167 801.723 ↓ 1.0 30,446 1

Hash Join (cost=35,805.56..125,968.07 rows=29,973 width=261) (actual time=223.309..801.723 rows=30,446 loops=1)

  • Hash Cond: (ende.codigo_cidade = cidade.codigo)
9. 33.471 778.915 ↓ 1.0 30,446 1

Nested Loop (cost=34,529.22..124,279.51 rows=29,998 width=147) (actual time=216.648..778.915 rows=30,446 loops=1)

10. 38.332 684.552 ↑ 1.0 30,446 1

Nested Loop (cost=34,528.80..106,959.33 rows=30,446 width=147) (actual time=216.640..684.552 rows=30,446 loops=1)

11. 98.337 585.328 ↑ 1.0 30,446 1

Hash Join (cost=34,528.37..88,934.01 rows=30,446 width=116) (actual time=216.625..585.328 rows=30,446 loops=1)

  • Hash Cond: (p.codigo = c.codigo_proposta)
12. 270.415 270.415 ↓ 1.0 368,322 1

Seq Scan on comercial_emprestimo_proposta p (cost=0.00..51,799.19 rows=368,319 width=32) (actual time=0.008..270.415 rows=368,322 loops=1)

13. 13.671 216.576 ↑ 1.0 30,446 1

Hash (cost=34,147.80..34,147.80 rows=30,446 width=88) (actual time=216.576..216.576 rows=30,446 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 3725kB
14. 84.402 202.905 ↑ 1.0 30,446 1

Hash Join (cost=2,002.04..34,147.80 rows=30,446 width=88) (actual time=28.354..202.905 rows=30,446 loops=1)

  • Hash Cond: (mutuario.codigo = c.codigo_mutuario)
15. 90.281 90.281 ↑ 1.0 368,703 1

Seq Scan on comercial_emprestimo_mutuario mutuario (cost=0.00..29,536.57 rows=368,757 width=8) (actual time=0.008..90.281 rows=368,703 loops=1)

16. 10.088 28.222 ↑ 1.0 30,446 1

Hash (cost=1,621.46..1,621.46 rows=30,446 width=88) (actual time=28.222..28.222 rows=30,446 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 3725kB
17. 18.134 18.134 ↑ 1.0 30,446 1

Seq Scan on comercial_emprestimo_comunicacao_perda_proago c (cost=0.00..1,621.46 rows=30,446 width=88) (actual time=0.009..18.134 rows=30,446 loops=1)

18. 60.892 60.892 ↑ 1.0 1 30,446

Index Scan using estrutura_entidade_pkey on estrutura_entidade coop (cost=0.42..0.58 rows=1 width=31) (actual time=0.002..0.002 rows=1 loops=30,446)

  • Index Cond: (codigo = p.codigo_cooperativa)
19. 60.892 60.892 ↑ 1.0 1 30,446

Index Scan using estrutura_endereco_pkey on estrutura_endereco ende (cost=0.43..0.56 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=30,446)

  • Index Cond: (codigo = coop.codigo_endereco)
20. 1.032 6.641 ↑ 1.0 5,565 1

Hash (cost=1,206.78..1,206.78 rows=5,565 width=122) (actual time=6.641..6.641 rows=5,565 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 321kB
21. 1.565 5.609 ↑ 1.0 5,565 1

Hash Join (cost=1.61..1,206.78 rows=5,565 width=122) (actual time=0.030..5.609 rows=5,565 loops=1)

  • Hash Cond: (cidade.codigo_estado = estado.codigo)
22. 4.030 4.030 ↑ 1.0 5,565 1

Seq Scan on estrutura_cidade cidade (cost=0.00..1,128.65 rows=5,565 width=8) (actual time=0.008..4.030 rows=5,565 loops=1)

23. 0.004 0.014 ↑ 1.0 27 1

Hash (cost=1.27..1.27 rows=27 width=122) (actual time=0.014..0.014 rows=27 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
24. 0.010 0.010 ↑ 1.0 27 1

Seq Scan on estrutura_estado estado (cost=0.00..1.27 rows=27 width=122) (actual time=0.006..0.010 rows=27 loops=1)

25. 8.755 16.963 ↑ 1.0 50,876 1

Hash (cost=1,064.76..1,064.76 rows=50,876 width=22) (actual time=16.963..16.963 rows=50,876 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3292kB
26. 8.208 8.208 ↑ 1.0 50,876 1

Seq Scan on estrutura_empresa empresa_cresol (cost=0.00..1,064.76 rows=50,876 width=22) (actual time=0.004..8.208 rows=50,876 loops=1)

27. 0.091 3.435 ↓ 1.0 247 1

Hash (cost=496.40..496.40 rows=246 width=259) (actual time=3.435..3.435 rows=247 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
28. 0.098 3.344 ↓ 1.0 247 1

Hash Join (cost=375.95..496.40 rows=246 width=259) (actual time=2.386..3.344 rows=247 loops=1)

  • Hash Cond: (leiaute.codigo_banco = banco.codigo)
29. 0.026 3.234 ↓ 1.0 247 1

Nested Loop (cost=374.55..491.61 rows=246 width=45) (actual time=2.368..3.234 rows=247 loops=1)

30. 0.099 2.467 ↓ 1.0 247 1

Hash Join (cost=374.26..385.10 rows=246 width=12) (actual time=2.345..2.467 rows=247 loops=1)

  • Hash Cond: (modelo.codigo_leiaute_linha_credito = leiaute.codigo)
31. 0.043 0.043 ↓ 1.0 247 1

Seq Scan on comercial_emprestimo_modelo modelo (cost=0.00..7.46 rows=246 width=8) (actual time=0.006..0.043 rows=247 loops=1)

32. 0.786 2.325 ↑ 1.0 4,945 1

Hash (cost=312.45..312.45 rows=4,945 width=12) (actual time=2.325..2.325 rows=4,945 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 277kB
33. 1.539 1.539 ↑ 1.0 4,945 1

Seq Scan on comercial_emprestimo_leiaute_linha_credito leiaute (cost=0.00..312.45 rows=4,945 width=12) (actual time=0.006..1.539 rows=4,945 loops=1)

34. 0.741 0.741 ↑ 1.0 1 247

Index Scan using comercial_emprestimo_linha_credito_abstract_pkey on comercial_emprestimo_linha_credito_abstract linha (cost=0.28..0.42 rows=1 width=41) (actual time=0.002..0.003 rows=1 loops=247)

  • Index Cond: (codigo = leiaute.codigo_linha_credito)
35. 0.004 0.012 ↑ 1.0 18 1

Hash (cost=1.18..1.18 rows=18 width=222) (actual time=0.012..0.012 rows=18 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
36. 0.008 0.008 ↑ 1.0 18 1

Seq Scan on estrutura_banco banco (cost=0.00..1.18 rows=18 width=222) (actual time=0.006..0.008 rows=18 loops=1)

37. 121.784 121.784 ↑ 1.0 1 30,446

Index Scan using estrutura_conta_cooperado_pkey on estrutura_conta_cooperado conta (cost=0.42..0.50 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=30,446)

  • Index Cond: (codigo = mutuario.codigo_conta_cooperado)
38. 121.784 121.784 ↑ 1.0 1 30,446

Index Scan using estrutura_entidade_pkey on estrutura_entidade cooperado (cost=0.42..0.56 rows=1 width=27) (actual time=0.004..0.004 rows=1 loops=30,446)

  • Index Cond: (codigo = conta.codigo_cooperado)
39. 0.004 0.016 ↑ 1.0 10 1

Hash (cost=2.10..2.10 rows=10 width=12) (actual time=0.016..0.016 rows=10 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
40. 0.012 0.012 ↑ 1.0 10 1

Seq Scan on comercial_emprestimo_safra safra (cost=0.00..2.10 rows=10 width=12) (actual time=0.007..0.012 rows=10 loops=1)

41. 235.336 358.578 ↑ 1.0 604,962 1

Hash (cost=17,238.13..17,238.13 rows=605,013 width=27) (actual time=358.578..358.578 rows=604,962 loops=1)

  • Buckets: 65536 Batches: 16 Memory Usage: 2773kB
42. 123.242 123.242 ↑ 1.0 604,962 1

Seq Scan on estrutura_entidade usuario (cost=0.00..17,238.13 rows=605,013 width=27) (actual time=0.010..123.242 rows=604,962 loops=1)

43. 5.169 45.956 ↓ 1.0 16,403 1

Hash (cost=4,101.35..4,101.35 rows=16,402 width=109) (actual time=45.956..45.956 rows=16,403 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1456kB
44. 6.782 40.787 ↓ 1.0 16,403 1

Hash Right Join (cost=1,126.22..4,101.35 rows=16,402 width=109) (actual time=11.088..40.787 rows=16,403 loops=1)

  • Hash Cond: (su_atual.codigo_laudo_pericial_atual = laudo.codigo)
45. 13.583 28.157 ↑ 1.0 15,642 1

Hash Right Join (cost=512.17..3,273.02 rows=15,741 width=109) (actual time=5.147..28.157 rows=15,642 loops=1)

  • Hash Cond: (su.codigo = su_atual.codigo_sumula_ultimo_julgamento)
46. 9.495 9.495 ↑ 1.0 34,103 1

Seq Scan on proagroonline_sumula_julgamento su (cost=0.00..2,476.17 rows=34,117 width=109) (actual time=0.007..9.495 rows=34,103 loops=1)

47. 2.392 5.079 ↑ 1.0 15,642 1

Hash (cost=315.41..315.41 rows=15,741 width=8) (actual time=5.079..5.079 rows=15,642 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 738kB
48. 2.687 2.687 ↑ 1.0 15,642 1

Seq Scan on proagroonline_sumula_julgamento_atual su_atual (cost=0.00..315.41 rows=15,741 width=8) (actual time=0.005..2.687 rows=15,642 loops=1)

49. 2.611 5.848 ↓ 1.0 16,403 1

Hash (cost=409.02..409.02 rows=16,402 width=8) (actual time=5.848..5.848 rows=16,403 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 897kB
50. 3.237 3.237 ↓ 1.0 16,403 1

Seq Scan on proagroonline_laudo_pericial_atual laudo (cost=0.00..409.02 rows=16,402 width=8) (actual time=0.008..3.237 rows=16,403 loops=1)

51.          

SubPlan (forHash Left Join)

52. 60.892 60.892 ↑ 1.0 1 30,446

Index Scan using estrutura_entidade_pkey on estrutura_entidade (cost=0.42..8.44 rows=1 width=23) (actual time=0.002..0.002 rows=1 loops=30,446)

  • Index Cond: (codigo = c.codigo_assistencia_tecnica)
53. 60.892 60.892 ↑ 1.0 1 30,446

Index Scan using estrutura_entidade_pkey on estrutura_entidade estrutura_entidade_1 (cost=0.42..8.44 rows=1 width=23) (actual time=0.001..0.002 rows=1 loops=30,446)

  • Index Cond: (codigo = c.codigo_tecnico_agronomo)
54. 121.784 121.784 ↑ 1.0 1 30,446

Index Scan using estrutura_pessoa_pkey on estrutura_pessoa (cost=0.42..8.44 rows=1 width=54) (actual time=0.004..0.004 rows=1 loops=30,446)

  • Index Cond: (codigo = conta.codigo_cooperado)
55. 0.000 0.000 ↓ 0.0 0

Index Scan using empresa_pkey on estrutura_empresa (cost=0.29..8.31 rows=1 width=18) (never executed)

  • Index Cond: (codigo = conta.codigo_cooperado)
56. 0.000 213.122 ↑ 1.0 1 30,446

Limit (cost=0.70..16.74 rows=1 width=4) (actual time=0.007..0.007 rows=1 loops=30,446)

57. 30.446 213.122 ↑ 1.0 1 30,446

Nested Loop (cost=0.70..16.74 rows=1 width=4) (actual time=0.007..0.007 rows=1 loops=30,446)

58. 121.784 121.784 ↑ 1.0 1 30,446

Index Scan using comercial_emprestimo_empreendimento_proposta_id1 on comercial_emprestimo_empreendimento_proposta empr_prop (cost=0.42..8.44 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=30,446)

  • Index Cond: (codigo_proposta = c.codigo_proposta)
59. 60.892 60.892 ↑ 1.0 1 30,446

Index Only Scan using comercial_emprestimo_empreendimento_pkey on comercial_emprestimo_empreendimento empr (cost=0.28..8.29 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=30,446)

  • Index Cond: (codigo = empr_prop.codigo_empreendimento)
  • Heap Fetches: 30446
60. 0.000 152.230 ↑ 1.0 1 30,446

Limit (cost=0.70..16.74 rows=1 width=38) (actual time=0.005..0.005 rows=1 loops=30,446)

61. 60.892 152.230 ↑ 1.0 1 30,446

Nested Loop (cost=0.70..16.74 rows=1 width=38) (actual time=0.005..0.005 rows=1 loops=30,446)

62. 60.892 60.892 ↑ 1.0 1 30,446

Index Scan using comercial_emprestimo_empreendimento_proposta_id1 on comercial_emprestimo_empreendimento_proposta empr_prop_1 (cost=0.42..8.44 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=30,446)

  • Index Cond: (codigo_proposta = c.codigo_proposta)
63. 30.446 30.446 ↑ 1.0 1 30,446

Index Scan using comercial_emprestimo_empreendimento_pkey on comercial_emprestimo_empreendimento empr_1 (cost=0.28..8.29 rows=1 width=42) (actual time=0.001..0.001 rows=1 loops=30,446)

  • Index Cond: (codigo = empr_prop_1.codigo_empreendimento)
64. 30.446 395.798 ↑ 2.0 1 30,446

Append (cost=0.98..40.93 rows=2 width=23) (actual time=0.007..0.013 rows=1 loops=30,446)

65. 30.446 243.568 ↑ 1.0 1 30,446

Nested Loop (cost=0.98..17.06 rows=1 width=23) (actual time=0.007..0.008 rows=1 loops=30,446)

  • Join Filter: (empresa.codigo_empresa_pai = emp_base.codigo)
66. 30.446 152.230 ↑ 1.0 1 30,446

Nested Loop (cost=0.70..16.75 rows=1 width=31) (actual time=0.004..0.005 rows=1 loops=30,446)

67. 60.892 60.892 ↑ 1.0 1 30,446

Index Scan using empresa_cresol_pkey on estrutura_empresa_cresol empresa (cost=0.28..8.29 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=30,446)

  • Index Cond: (codigo = coop.codigo)
68. 60.892 60.892 ↑ 1.0 1 30,446

Index Scan using estrutura_entidade_pkey on estrutura_entidade enti (cost=0.42..8.44 rows=1 width=27) (actual time=0.002..0.002 rows=1 loops=30,446)

  • Index Cond: (codigo = empresa.codigo_empresa_pai)
69. 60.892 60.892 ↑ 1.0 1 30,446

Index Scan using empresa_cresol_pkey on estrutura_empresa_cresol emp_base (cost=0.28..0.30 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=30,446)

  • Index Cond: (codigo = enti.codigo)
  • Filter: (codigo_grupo_empresa = 2)
  • Rows Removed by Filter: 0
70. 0.000 121.784 ↓ 0.0 0 30,446

Nested Loop (cost=1.26..23.85 rows=1 width=23) (actual time=0.004..0.004 rows=0 loops=30,446)

  • Join Filter: (emp_pai.codigo_empresa_pai = emp_base_1.codigo)
71. 0.000 121.784 ↓ 0.0 0 30,446

Nested Loop (cost=0.98..23.54 rows=1 width=31) (actual time=0.004..0.004 rows=0 loops=30,446)

72. 0.000 121.784 ↓ 0.0 0 30,446

Nested Loop (cost=0.56..16.60 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=30,446)

73. 60.892 60.892 ↑ 1.0 1 30,446

Index Scan using empresa_cresol_pkey on estrutura_empresa_cresol empresa_1 (cost=0.28..8.29 rows=1 width=4) (actual time=0.001..0.002 rows=1 loops=30,446)

  • Index Cond: (codigo = coop.codigo)
74. 60.892 60.892 ↓ 0.0 0 30,446

Index Scan using empresa_cresol_pkey on estrutura_empresa_cresol emp_pai (cost=0.28..8.30 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=30,446)

  • Index Cond: (codigo = empresa_1.codigo_empresa_pai)
  • Filter: (codigo_grupo_empresa <> 2)
  • Rows Removed by Filter: 1
75. 1.030 1.030 ↑ 1.0 1 515

Index Scan using estrutura_entidade_pkey on estrutura_entidade enti_1 (cost=0.42..6.93 rows=1 width=27) (actual time=0.002..0.002 rows=1 loops=515)

  • Index Cond: (codigo = emp_pai.codigo_empresa_pai)
76. 1.030 1.030 ↑ 1.0 1 515

Index Scan using empresa_cresol_pkey on estrutura_empresa_cresol emp_base_1 (cost=0.28..0.30 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=515)

  • Index Cond: (codigo = enti_1.codigo)
  • Filter: (codigo_grupo_empresa = 2)
Planning time : 10.749 ms
Execution time : 2,886.940 ms