explain.depesz.com

PostgreSQL's explain analyze made readable

Result: oFvV : Optimization for: plan #R74U

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 160.479 4,563.278 ↓ 1.0 30,446 1

Hash Left Join (cost=71,251.99..2,941,229.50 rows=29,973 width=677) (actual time=2,104.157..4,563.278 rows=30,446 loops=1)

  • Hash Cond: (c.codigo = laudo.codigo_comunicacao_perda)
2. 169.230 3,470.519 ↓ 1.0 30,446 1

Hash Join (cost=66,945.61..199,375.32 rows=29,973 width=572) (actual time=2,054.515..3,470.519 rows=30,446 loops=1)

  • Hash Cond: (c.codigo_usuario_solicitacao = usuario.codigo)
3. 15.115 2,164.448 ↓ 1.0 30,446 1

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

  • Hash Cond: (p.codigo_safra = safra.codigo)
4. 22.091 2,138.636 ↓ 1.0 30,446 1

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

5. 21.205 1,903.423 ↓ 1.0 30,446 1

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

6. 14.398 1,577.758 ↓ 1.0 30,446 1

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

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

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

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

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

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

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

10. 39.875 1,085.890 ↑ 1.0 30,446 1

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

11. 97.347 985.123 ↑ 1.0 30,446 1

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

  • Hash Cond: (p.codigo = c.codigo_proposta)
12. 342.701 342.701 ↓ 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=7.566..342.701 rows=368,322 loops=1)

13. 18.896 545.075 ↑ 1.0 30,446 1

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

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

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

  • Hash Cond: (mutuario.codigo = c.codigo_mutuario)
15. 276.137 276.137 ↑ 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=15.325..276.137 rows=368,703 loops=1)

16. 18.193 137.203 ↑ 1.0 30,446 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 3725kB
17. 119.010 119.010 ↑ 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=13.270..119.010 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.790 151.733 ↑ 1.0 5,565 1

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

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

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

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

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

23. 0.012 10.287 ↑ 1.0 27 1

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

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

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

25. 15.073 74.100 ↑ 1.0 50,876 1

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

  • Buckets: 65536 Batches: 1 Memory Usage: 3292kB
26. 59.027 59.027 ↑ 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.007..59.027 rows=50,876 loops=1)

27. 0.198 128.019 ↓ 1.0 247 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 29kB
28. 0.268 127.821 ↓ 1.0 247 1

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

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

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

30. 0.218 56.995 ↓ 1.0 247 1

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

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

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

32. 1.427 46.485 ↑ 1.0 4,945 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 277kB
33. 45.058 45.058 ↑ 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=8.474..45.058 rows=4,945 loops=1)

34. 65.455 65.455 ↑ 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.265..0.265 rows=1 loops=247)

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

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

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

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

37. 304.460 304.460 ↑ 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.010..0.010 rows=1 loops=30,446)

  • Index Cond: (codigo = mutuario.codigo_conta_cooperado)
38. 213.122 213.122 ↑ 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.007..0.007 rows=1 loops=30,446)

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

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

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

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

41. 304.446 1,136.841 ↑ 1.0 604,962 1

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

  • Buckets: 65536 Batches: 16 Memory Usage: 2773kB
42. 832.395 832.395 ↑ 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.024..832.395 rows=604,962 loops=1)

43. 5.314 49.346 ↓ 1.0 16,403 1

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

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

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

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

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

  • Hash Cond: (su.codigo = su_atual.codigo_sumula_ultimo_julgamento)
46. 11.448 11.448 ↑ 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..11.448 rows=34,103 loops=1)

47. 2.403 5.283 ↑ 1.0 15,642 1

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

  • Buckets: 16384 Batches: 1 Memory Usage: 738kB
48. 2.880 2.880 ↑ 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.880 rows=15,642 loops=1)

49. 2.708 6.137 ↓ 1.0 16,403 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 897kB
50. 3.429 3.429 ↓ 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.009..3.429 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. 30.446 243.568 ↑ 1.0 1 30,446

Limit (cost=0.70..16.74 rows=1 width=4) (actual time=0.008..0.008 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. 30.446 395.798 ↑ 2.0 1 30,446

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

61. 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)
62. 30.446 152.230 ↑ 1.0 1 30,446

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

63. 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)
64. 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)
65. 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
66. 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)
67. 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)

68. 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)

69. 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)
70. 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
71. 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)
72. 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 : 771.777 ms
Execution time : 4,566.715 ms