explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZeJj

Settings
# exclusive inclusive rows x rows loops node
1. 0.015 1,263.976 ↑ 1.0 6 1

Sort (cost=7,968.36..7,968.37 rows=6 width=224) (actual time=1,263.976..1,263.976 rows=6 loops=1)

  • Sort Key: ('Adto/Saldo/V. Comb'::text)
  • Sort Method: quicksort Memory: 25kB
2.          

CTE with_dados_gerais_vencida

3. 0.037 22.052 ↑ 2.2 67 1

Hash Anti Join (cost=926.03..2,280.53 rows=147 width=60) (actual time=20.245..22.052 rows=67 loops=1)

  • Hash Cond: (m.cd_movimento = em_.cd_movimento)
4. 0.091 21.974 ↑ 2.2 67 1

Nested Loop (cost=922.74..2,275.38 rows=147 width=60) (actual time=20.190..21.974 rows=67 loops=1)

5. 17.290 21.682 ↑ 7.3 67 1

Hash Join (cost=922.45..1,271.80 rows=488 width=54) (actual time=20.153..21.682 rows=67 loops=1)

  • Hash Cond: (td.cd_titulo = t.cd_titulo)
6. 3.315 3.315 ↑ 1.0 17,612 1

Seq Scan on titulo_debito td (cost=0.00..303.12 rows=17,612 width=4) (actual time=0.011..3.315 rows=17,612 loops=1)

7. 0.137 1.077 ↑ 5.1 305 1

Hash (cost=903.10..903.10 rows=1,548 width=54) (actual time=1.077..1.077 rows=305 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 35kB
8. 0.851 0.940 ↑ 5.1 305 1

Bitmap Heap Scan on titulo t (cost=33.25..903.10 rows=1,548 width=54) (actual time=0.124..0.940 rows=305 loops=1)

  • Recheck Cond: ((dt_quitacao IS NULL) OR (dt_quitacao > (CURRENT_DATE - 1)))
  • Filter: (dt_vencimento < (CURRENT_DATE - 1))
  • Rows Removed by Filter: 1,132
  • Heap Blocks: exact=131
9. 0.000 0.089 ↓ 0.0 0 1

BitmapOr (cost=33.25..33.25 rows=1,586 width=0) (actual time=0.089..0.089 rows=0 loops=1)

10. 0.080 0.080 ↑ 1.0 1,412 1

Bitmap Index Scan on idx_titulo_dt_quitacao (cost=0.00..26.98 rows=1,425 width=0) (actual time=0.080..0.080 rows=1,412 loops=1)

  • Index Cond: (dt_quitacao IS NULL)
11. 0.009 0.009 ↑ 6.4 25 1

Bitmap Index Scan on idx_titulo_dt_quitacao (cost=0.00..5.50 rows=161 width=0) (actual time=0.009..0.009 rows=25 loops=1)

  • Index Cond: (dt_quitacao > (CURRENT_DATE - 1))
12. 0.201 0.201 ↑ 1.0 1 67

Index Scan using pk_movimento on movimento m (cost=0.29..2.06 rows=1 width=10) (actual time=0.003..0.003 rows=1 loops=67)

  • Index Cond: (cd_movimento = t.cd_movimento)
  • Filter: ((id_tipo = 2) AND (dt_movimento <= (CURRENT_DATE - 1)))
13. 0.000 0.041 ↓ 0.0 0 1

Hash (cost=3.26..3.26 rows=3 width=4) (actual time=0.041..0.041 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
14. 0.006 0.041 ↓ 0.0 0 1

Hash Join (cost=2.15..3.26 rows=3 width=4) (actual time=0.041..0.041 rows=0 loops=1)

  • Hash Cond: (fi_.cd_pessoa_filial = e_.cd_pessoa)
15. 0.010 0.010 ↑ 1.0 5 1

Seq Scan on filial fi_ (cost=0.00..1.05 rows=5 width=4) (actual time=0.009..0.010 rows=5 loops=1)

16. 0.002 0.025 ↑ 1.0 3 1

Hash (cost=2.12..2.12 rows=3 width=8) (actual time=0.025..0.025 rows=3 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
17. 0.008 0.023 ↑ 1.0 3 1

Hash Join (cost=1.07..2.12 rows=3 width=8) (actual time=0.020..0.023 rows=3 loops=1)

  • Hash Cond: (em_.cd_emprestimo = e_.cd_emprestimo)
18. 0.004 0.004 ↑ 1.0 3 1

Seq Scan on emprestimo_movimento em_ (cost=0.00..1.03 rows=3 width=8) (actual time=0.003..0.004 rows=3 loops=1)

19. 0.005 0.011 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=8) (actual time=0.010..0.011 rows=3 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
20. 0.006 0.006 ↑ 1.0 3 1

Seq Scan on emprestimo e_ (cost=0.00..1.03 rows=3 width=8) (actual time=0.004..0.006 rows=3 loops=1)

21.          

CTE with_movimento_vencida

22. 0.047 0.065 ↑ 2.2 67 1

HashAggregate (cost=4.04..5.88 rows=147 width=36) (actual time=0.053..0.065 rows=67 loops=1)

  • Group Key: wdg.cd_movimento, CASE WHEN (wdg.vl_movimento = '0'::numeric) THEN '1'::numeric ELSE wdg.vl_movimento END
23. 0.018 0.018 ↑ 2.2 67 1

CTE Scan on with_dados_gerais_vencida wdg (cost=0.00..3.31 rows=147 width=36) (actual time=0.002..0.018 rows=67 loops=1)

24.          

CTE with_total_titulo_vencida

25. 0.056 22.271 ↑ 2.2 67 1

HashAggregate (cost=7.72..12.49 rows=147 width=44) (actual time=22.256..22.271 rows=67 loops=1)

  • Group Key: wdg_1.cd_movimento, wdg_1.cd_titulo, wdg_1.dt_quitacao, ((((((COALESCE(wdg_1.vl_titulo, '0'::numeric) + COALESCE(wdg_1.vl_juro, '0'::numeric)) + COALESCE(wdg_1.vl_multa, '0'::numeric)) + COALESCE(wdg_1.vl_emolumento, '0'::numeric)) + COALESCE(wdg_1.vl_acrescimo, '0'::numeric)) - COALESCE(wdg_1.vl_desconto, '0'::numeric)) - CASE WHEN (wdg_1.dt_quitacao > (CURRENT_DATE - 1)) THEN '0'::numeric ELSE COALESCE(wdg_1.vl_pago, '0'::numeric) END)
26. 22.215 22.215 ↑ 2.2 67 1

CTE Scan on with_dados_gerais_vencida wdg_1 (cost=0.00..6.25 rows=147 width=44) (actual time=20.258..22.215 rows=67 loops=1)

27.          

CTE with_valores_ctrc_vencida

28. 0.122 3.918 ↓ 1.5 249 1

Unique (cost=1,595.88..1,600.33 rows=162 width=34) (actual time=3.773..3.918 rows=249 loops=1)

29. 0.163 3.796 ↓ 1.5 249 1

Sort (cost=1,595.88..1,596.28 rows=162 width=34) (actual time=3.773..3.796 rows=249 loops=1)

  • Sort Key: ct.cd_ctrc, cfp.cd_movimento, cfpa.vl_parcelamento, ct.id_tipo, cf.id_pedagio, cf.vl_pedagio_pago, cfp.nr_parcela, cc.vl_complemento, cf.vl_quebra, cfp.id_tipo
  • Sort Method: quicksort Memory: 44kB
30. 0.183 3.633 ↓ 1.5 249 1

Nested Loop (cost=1.46..1,589.93 rows=162 width=34) (actual time=0.064..3.633 rows=249 loops=1)

  • Join Filter: (ct.cd_ctrc = cf.cd_ctrc)
31. 0.198 2.952 ↓ 1.6 249 1

Nested Loop Left Join (cost=1.17..1,532.25 rows=151 width=31) (actual time=0.054..2.952 rows=249 loops=1)

  • Join Filter: (cc.cd_ctrc = ct.cd_ctrc)
  • Rows Removed by Join Filter: 249
32. 0.166 2.754 ↓ 1.6 249 1

Nested Loop Left Join (cost=1.17..1,528.98 rows=151 width=28) (actual time=0.044..2.754 rows=249 loops=1)

  • Filter: CASE WHEN (cte.cd_ctrc IS NOT NULL) THEN (cte.cd_status = 100) ELSE true END
33. 0.320 2.090 ↑ 1.2 249 1

Nested Loop (cost=0.88..1,358.01 rows=302 width=28) (actual time=0.035..2.090 rows=249 loops=1)

34. 0.300 1.272 ↑ 1.4 249 1

Nested Loop (cost=0.58..1,208.74 rows=337 width=22) (actual time=0.024..1.272 rows=249 loops=1)

35. 0.061 0.474 ↑ 1.5 249 1

Nested Loop (cost=0.29..1,039.31 rows=368 width=12) (actual time=0.013..0.474 rows=249 loops=1)

36. 0.011 0.011 ↑ 2.2 67 1

CTE Scan on with_movimento_vencida wm (cost=0.00..2.94 rows=147 width=4) (actual time=0.000..0.011 rows=67 loops=1)

37. 0.402 0.402 ↓ 1.3 4 67

Index Scan using idx_carta_frete_pagamento_cd_movimento on carta_frete_pagamento cfp (cost=0.29..7.02 rows=3 width=12) (actual time=0.003..0.006 rows=4 loops=67)

  • Index Cond: (cd_movimento = wm.cd_movimento)
  • Filter: (COALESCE((dt_recebimento)::timestamp without time zone, dt_troca) <= (CURRENT_DATE - 1))
38. 0.498 0.498 ↑ 1.0 1 249

Index Scan using pk_carta_frete_parcelamento on carta_frete_parcelamento cfpa (cost=0.29..0.46 rows=1 width=14) (actual time=0.002..0.002 rows=1 loops=249)

  • Index Cond: ((cd_ctrc = cfp.cd_ctrc) AND (id_tipo = cfp.id_tipo) AND (nr_parcela = cfp.nr_parcela))
39. 0.498 0.498 ↑ 1.0 1 249

Index Scan using pk_ctrc on ctrc ct (cost=0.29..0.44 rows=1 width=6) (actual time=0.002..0.002 rows=1 loops=249)

  • Index Cond: (cd_ctrc = cfpa.cd_ctrc)
40. 0.498 0.498 ↑ 1.0 1 249

Index Scan using pk_ctrc_cte on ctrc_cte cte (cost=0.29..0.55 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=249)

  • Index Cond: (cd_ctrc = ct.cd_ctrc)
41. 0.000 0.000 ↑ 1.0 1 249

Materialize (cost=0.00..1.01 rows=1 width=7) (actual time=0.000..0.000 rows=1 loops=249)

42. 0.006 0.006 ↑ 1.0 1 1

Seq Scan on ctrc_complemento cc (cost=0.00..1.01 rows=1 width=7) (actual time=0.005..0.006 rows=1 loops=1)

43. 0.498 0.498 ↑ 1.0 1 249

Index Scan using pk_carta_frete on carta_frete cf (cost=0.29..0.37 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=249)

  • Index Cond: (cd_ctrc = cfpa.cd_ctrc)
44.          

CTE with_ctrc_vencida

45. 0.124 0.330 ↓ 1.3 206 1

HashAggregate (cost=3.65..5.27 rows=162 width=4) (actual time=0.298..0.330 rows=206 loops=1)

  • Group Key: with_valores_ctrc_vencida.cd_ctrc
46. 0.206 0.206 ↓ 1.5 249 1

CTE Scan on with_valores_ctrc_vencida (cost=0.00..3.24 rows=162 width=4) (actual time=0.000..0.206 rows=249 loops=1)

47.          

CTE with_caixa_vencida

48. 2.207 7.494 ↑ 1.8 32 1

Hash Join (cost=4.78..583.48 rows=57 width=14) (actual time=3.507..7.494 rows=32 loops=1)

  • Hash Cond: (cx.cd_movimento = wm_1.cd_movimento)
49. 5.265 5.265 ↓ 3.0 11,647 1

Seq Scan on caixa cx (cost=0.00..563.54 rows=3,892 width=14) (actual time=0.005..5.265 rows=11,647 loops=1)

  • Filter: ((dt_lancamento)::date <= (CURRENT_DATE - 1))
  • Rows Removed by Filter: 30
50. 0.011 0.022 ↑ 2.2 67 1

Hash (cost=2.94..2.94 rows=147 width=4) (actual time=0.022..0.022 rows=67 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
51. 0.011 0.011 ↑ 2.2 67 1

CTE Scan on with_movimento_vencida wm_1 (cost=0.00..2.94 rows=147 width=4) (actual time=0.001..0.011 rows=67 loops=1)

52.          

CTE with_vencida

53. 0.065 36.053 ↑ 1.0 1 1

Aggregate (cost=195.87..195.88 rows=1 width=192) (actual time=36.053..36.053 rows=1 loops=1)

54. 0.021 35.988 ↑ 2.2 67 1

Hash Left Join (cost=181.95..191.08 rows=147 width=208) (actual time=35.782..35.988 rows=67 loops=1)

  • Hash Cond: (wtt.cd_movimento = wvvv.cd_movimento)
55. 0.035 35.785 ↑ 2.2 67 1

Hash Left Join (cost=166.59..175.32 rows=147 width=180) (actual time=35.595..35.785 rows=67 loops=1)

  • Hash Cond: (wtt.cd_movimento = wvc.cd_movimento)
56. 0.022 35.724 ↑ 2.2 67 1

Hash Left Join (cost=163.45..171.79 rows=147 width=176) (actual time=35.564..35.724 rows=67 loops=1)

  • Hash Cond: (wtt.cd_movimento = em.cd_movimento)
57. 0.020 35.665 ↑ 2.2 67 1

Hash Left Join (cost=157.49..165.42 rows=147 width=172) (actual time=35.523..35.665 rows=67 loops=1)

  • Hash Cond: (wtt.cd_movimento = im.cd_movimento)
58. 0.022 35.614 ↑ 2.2 67 1

Hash Left Join (cost=75.72..83.27 rows=147 width=168) (actual time=35.488..35.614 rows=67 loops=1)

  • Hash Cond: (wtt.cd_movimento = wm_4.cd_movimento)
59. 0.024 35.536 ↑ 2.2 67 1

Hash Left Join (cost=69.36..76.50 rows=147 width=164) (actual time=35.426..35.536 rows=67 loops=1)

  • Hash Cond: (wtt.cd_titulo = wtt_1.cd_titulo)
60. 0.036 27.762 ↑ 2.2 67 1

Hash Right Join (cost=47.33..53.39 rows=147 width=72) (actual time=27.671..27.762 rows=67 loops=1)

  • Hash Cond: (wtt_2.cd_titulo = wtt.cd_titulo)
61. 0.388 5.409 ↑ 2.2 67 1

HashAggregate (cost=42.55..45.12 rows=147 width=104) (actual time=5.346..5.409 rows=67 loops=1)

  • Group Key: wtt_2.cd_titulo, wm_3.vl_movimento, wtt_2.vl_total_titulo
62. 0.157 5.021 ↓ 1.8 268 1

Hash Join (cost=25.86..35.20 rows=147 width=212) (actual time=4.549..5.021 rows=268 loops=1)

  • Hash Cond: (wtt_2.cd_movimento = wm_3.cd_movimento)
63. 0.099 4.763 ↓ 1.8 268 1

Hash Left Join (cost=21.08..28.40 rows=147 width=184) (actual time=4.441..4.763 rows=268 loops=1)

  • Hash Cond: (wvc_1.cd_ctrc = wc.cd_ctrc)
64. 0.076 4.536 ↓ 1.8 268 1

Hash Left Join (cost=11.74..17.63 rows=147 width=156) (actual time=4.307..4.536 rows=268 loops=1)

  • Hash Cond: (wvc_1.cd_ctrc = wc_1.cd_ctrc)
65. 0.117 3.966 ↓ 1.8 268 1

Hash Right Join (cost=4.78..10.10 rows=147 width=124) (actual time=3.806..3.966 rows=268 loops=1)

  • Hash Cond: (wvc_1.cd_movimento = wtt_2.cd_movimento)
66. 3.824 3.824 ↓ 1.5 249 1

CTE Scan on with_valores_ctrc_vencida wvc_1 (cost=0.00..3.24 rows=162 width=88) (actual time=3.775..3.824 rows=249 loops=1)

67. 0.013 0.025 ↑ 2.2 67 1

Hash (cost=2.94..2.94 rows=147 width=40) (actual time=0.025..0.025 rows=67 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 12kB
68. 0.012 0.012 ↑ 2.2 67 1

CTE Scan on with_total_titulo_vencida wtt_2 (cost=0.00..2.94 rows=147 width=40) (actual time=0.001..0.012 rows=67 loops=1)

69. 0.000 0.494 ↓ 0.0 0 1

Hash (cost=6.94..6.94 rows=2 width=36) (actual time=0.494..0.494 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
70. 0.078 0.494 ↓ 0.0 0 1

Hash Join (cost=3.26..6.94 rows=2 width=36) (actual time=0.494..0.494 rows=0 loops=1)

  • Hash Cond: (wc_1.cd_ctrc = cfvp_1.cd_ctrc)
71. 0.387 0.387 ↓ 1.3 206 1

CTE Scan on with_ctrc_vencida wc_1 (cost=0.00..3.24 rows=162 width=4) (actual time=0.299..0.387 rows=206 loops=1)

72. 0.002 0.029 ↑ 1.0 2 1

Hash (cost=3.24..3.24 rows=2 width=36) (actual time=0.029..0.029 rows=2 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
73. 0.027 0.027 ↑ 1.0 2 1

Seq Scan on carta_frete_vale_pedagio cfvp_1 (cost=0.00..3.24 rows=2 width=36) (actual time=0.007..0.027 rows=2 loops=1)

  • Filter: (id_antecipado = '1'::smallint)
  • Rows Removed by Filter: 97
74. 0.002 0.128 ↑ 24.2 4 1

Hash (cost=8.13..8.13 rows=97 width=36) (actual time=0.128..0.128 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
75. 0.037 0.126 ↑ 24.2 4 1

Hash Join (cost=4.45..8.13 rows=97 width=36) (actual time=0.052..0.126 rows=4 loops=1)

  • Hash Cond: (wc.cd_ctrc = cfvp.cd_ctrc)
76. 0.043 0.043 ↓ 1.3 206 1

CTE Scan on with_ctrc_vencida wc (cost=0.00..3.24 rows=162 width=4) (actual time=0.001..0.043 rows=206 loops=1)

77. 0.018 0.046 ↑ 1.0 97 1

Hash (cost=3.24..3.24 rows=97 width=36) (actual time=0.045..0.046 rows=97 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 12kB
78. 0.028 0.028 ↑ 1.0 97 1

Seq Scan on carta_frete_vale_pedagio cfvp (cost=0.00..3.24 rows=97 width=36) (actual time=0.004..0.028 rows=97 loops=1)

  • Filter: (id_antecipado = '0'::smallint)
  • Rows Removed by Filter: 2
79. 0.013 0.101 ↑ 2.2 67 1

Hash (cost=2.94..2.94 rows=147 width=36) (actual time=0.100..0.101 rows=67 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
80. 0.088 0.088 ↑ 2.2 67 1

CTE Scan on with_movimento_vencida wm_3 (cost=0.00..2.94 rows=147 width=36) (actual time=0.054..0.088 rows=67 loops=1)

81. 0.019 22.317 ↑ 2.2 67 1

Hash (cost=2.94..2.94 rows=147 width=40) (actual time=22.317..22.317 rows=67 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 12kB
82. 22.298 22.298 ↑ 2.2 67 1

CTE Scan on with_total_titulo_vencida wtt (cost=0.00..2.94 rows=147 width=40) (actual time=22.259..22.298 rows=67 loops=1)

83. 0.006 7.750 ↑ 2.8 19 1

Hash (cost=21.37..21.37 rows=53 width=100) (actual time=7.749..7.750 rows=19 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
84. 0.017 7.744 ↑ 2.8 19 1

Hash Join (cost=17.35..21.37 rows=53 width=100) (actual time=7.724..7.744 rows=19 loops=1)

  • Hash Cond: (wm_2.cd_movimento = wtt_1.cd_movimento)
85. 0.009 0.009 ↑ 2.2 67 1

CTE Scan on with_movimento_vencida wm_2 (cost=0.00..2.94 rows=147 width=36) (actual time=0.000..0.009 rows=67 loops=1)

86. 0.005 7.718 ↑ 2.8 19 1

Hash (cost=16.68..16.68 rows=53 width=76) (actual time=7.718..7.718 rows=19 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
87. 0.018 7.713 ↑ 2.8 19 1

Hash Join (cost=13.35..16.68 rows=53 width=76) (actual time=7.692..7.713 rows=19 loops=1)

  • Hash Cond: (wtt_1.cd_movimento = wvhc.cd_movimento)
88. 0.009 0.009 ↑ 2.2 67 1

CTE Scan on with_total_titulo_vencida wtt_1 (cost=0.00..2.94 rows=147 width=40) (actual time=0.000..0.009 rows=67 loops=1)

89. 0.005 7.686 ↑ 2.8 19 1

Hash (cost=12.68..12.68 rows=53 width=36) (actual time=7.686..7.686 rows=19 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
90. 0.004 7.681 ↑ 2.8 19 1

Subquery Scan on wvhc (cost=11.49..12.68 rows=53 width=36) (actual time=7.671..7.681 rows=19 loops=1)

91. 0.027 7.677 ↑ 2.8 19 1

HashAggregate (cost=11.49..12.15 rows=53 width=36) (actual time=7.670..7.677 rows=19 loops=1)

  • Group Key: wc_2.cd_movimento
92. 0.035 7.650 ↑ 1.7 32 1

Hash Join (cost=2.27..11.23 rows=53 width=22) (actual time=7.540..7.650 rows=32 loops=1)

  • Hash Cond: (hc.cd_historico = wc_2.cd_historico)
93. 0.088 0.088 ↑ 1.0 181 1

Seq Scan on historico_caixa hc (cost=0.00..7.75 rows=181 width=4) (actual time=0.007..0.088 rows=181 loops=1)

  • Filter: ((id_tributo_federal = 0) AND (id_icms_terceiro = 0) AND (id_seguro_carga = 0) AND (id_inss_patronal = 0) AND (id_ipva = 0) AND (id_seguro_frota = 0))
  • Rows Removed by Filter: 9
94. 0.008 7.527 ↑ 1.8 32 1

Hash (cost=1.57..1.57 rows=56 width=26) (actual time=7.526..7.527 rows=32 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
95. 7.519 7.519 ↑ 1.8 32 1

CTE Scan on with_caixa_vencida wc_2 (cost=0.00..1.57 rows=56 width=26) (actual time=3.513..7.519 rows=32 loops=1)

  • Filter: ((cd_historico)::text <> '28'::text)
96. 0.000 0.056 ↓ 0.0 0 1

Hash (cost=6.36..6.36 rows=1 width=4) (actual time=0.056..0.056 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
97. 0.001 0.056 ↓ 0.0 0 1

Unique (cost=6.34..6.35 rows=1 width=4) (actual time=0.056..0.056 rows=0 loops=1)

98. 0.003 0.055 ↓ 0.0 0 1

Sort (cost=6.34..6.34 rows=1 width=4) (actual time=0.055..0.055 rows=0 loops=1)

  • Sort Key: wm_4.cd_movimento
  • Sort Method: quicksort Memory: 25kB
99. 0.012 0.052 ↓ 0.0 0 1

Hash Join (cost=2.83..6.33 rows=1 width=4) (actual time=0.052..0.052 rows=0 loops=1)

  • Hash Cond: (wm_4.cd_movimento = vpm.cd_movimento)
100. 0.008 0.008 ↑ 2.2 67 1

CTE Scan on with_movimento_vencida wm_4 (cost=0.00..2.94 rows=147 width=4) (actual time=0.000..0.008 rows=67 loops=1)

101. 0.001 0.032 ↓ 2.0 2 1

Hash (cost=2.82..2.82 rows=1 width=4) (actual time=0.032..0.032 rows=2 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
102. 0.006 0.031 ↓ 2.0 2 1

Hash Join (cost=1.09..2.82 rows=1 width=4) (actual time=0.029..0.031 rows=2 loops=1)

  • Hash Cond: (vp.cd_veiculo = vpm.cd_veiculo)
103. 0.019 0.019 ↓ 1.2 13 1

Seq Scan on veiculo_proprio vp (cost=0.00..1.66 rows=11 width=4) (actual time=0.011..0.019 rows=13 loops=1)

  • Filter: (COALESCE(dt_aquisicao, CURRENT_DATE) <= (CURRENT_DATE - 1))
  • Rows Removed by Filter: 20
104. 0.002 0.006 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=8) (actual time=0.006..0.006 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
105. 0.004 0.004 ↑ 1.0 4 1

Seq Scan on veiculo_proprio_movimento vpm (cost=0.00..1.04 rows=4 width=8) (actual time=0.003..0.004 rows=4 loops=1)

106. 0.001 0.031 ↓ 0.0 0 1

Hash (cost=79.26..79.26 rows=200 width=4) (actual time=0.031..0.031 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
107. 0.002 0.030 ↓ 0.0 0 1

HashAggregate (cost=75.26..77.26 rows=200 width=4) (actual time=0.030..0.030 rows=0 loops=1)

  • Group Key: im.cd_movimento
108. 0.002 0.028 ↓ 0.0 0 1

Hash Join (cost=26.91..73.87 rows=555 width=4) (actual time=0.028..0.028 rows=0 loops=1)

  • Hash Cond: (im.cd_movimento = wm_5.cd_movimento)
109. 0.001 0.003 ↓ 0.0 0 1

Hash Join (cost=22.14..60.71 rows=755 width=4) (actual time=0.002..0.003 rows=0 loops=1)

  • Hash Cond: (im.cd_investimento = inv.cd_investimento)
110. 0.002 0.002 ↓ 0.0 0 1

Seq Scan on investimento_movimento im (cost=0.00..32.60 rows=2,260 width=8) (actual time=0.002..0.002 rows=0 loops=1)

111. 0.000 0.000 ↓ 0.0 0

Hash (cost=19.80..19.80 rows=187 width=4) (never executed)

112. 0.000 0.000 ↓ 0.0 0

Seq Scan on investimento inv (cost=0.00..19.80 rows=187 width=4) (never executed)

  • Filter: (dt_compra <= (CURRENT_DATE - 1))
113. 0.012 0.023 ↑ 2.2 67 1

Hash (cost=2.94..2.94 rows=147 width=4) (actual time=0.022..0.023 rows=67 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
114. 0.011 0.011 ↑ 2.2 67 1

CTE Scan on with_movimento_vencida wm_5 (cost=0.00..2.94 rows=147 width=4) (actual time=0.001..0.011 rows=67 loops=1)

115. 0.001 0.037 ↓ 0.0 0 1

Hash (cost=5.94..5.94 rows=2 width=4) (actual time=0.037..0.037 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
116. 0.000 0.036 ↓ 0.0 0 1

Unique (cost=5.91..5.92 rows=2 width=4) (actual time=0.036..0.036 rows=0 loops=1)

117. 0.002 0.036 ↓ 0.0 0 1

Sort (cost=5.91..5.91 rows=3 width=4) (actual time=0.036..0.036 rows=0 loops=1)

  • Sort Key: em.cd_movimento
  • Sort Method: quicksort Memory: 25kB
118. 0.002 0.034 ↓ 0.0 0 1

Hash Join (cost=2.16..5.88 rows=3 width=4) (actual time=0.034..0.034 rows=0 loops=1)

  • Hash Cond: (em.cd_emprestimo = e.cd_emprestimo)
119. 0.011 0.024 ↓ 0.0 0 1

Hash Join (cost=1.07..4.77 rows=3 width=8) (actual time=0.024..0.024 rows=0 loops=1)

  • Hash Cond: (wm_6.cd_movimento = em.cd_movimento)
120. 0.008 0.008 ↑ 2.2 67 1

CTE Scan on with_movimento_vencida wm_6 (cost=0.00..2.94 rows=147 width=4) (actual time=0.000..0.008 rows=67 loops=1)

121. 0.002 0.005 ↑ 1.0 3 1

Hash (cost=1.03..1.03 rows=3 width=8) (actual time=0.005..0.005 rows=3 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
122. 0.003 0.003 ↑ 1.0 3 1

Seq Scan on emprestimo_movimento em (cost=0.00..1.03 rows=3 width=8) (actual time=0.003..0.003 rows=3 loops=1)

123. 0.002 0.008 ↑ 1.0 3 1

Hash (cost=1.05..1.05 rows=3 width=4) (actual time=0.007..0.008 rows=3 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
124. 0.006 0.006 ↑ 1.0 3 1

Seq Scan on emprestimo e (cost=0.00..1.05 rows=3 width=4) (actual time=0.005..0.006 rows=3 loops=1)

  • Filter: (dt_contrato <= (CURRENT_DATE - 1))
125. 0.004 0.026 ↑ 3.0 19 1

Hash (cost=2.42..2.42 rows=57 width=4) (actual time=0.026..0.026 rows=19 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
126. 0.004 0.022 ↑ 3.0 19 1

Subquery Scan on wvc (cost=1.28..2.42 rows=57 width=4) (actual time=0.015..0.022 rows=19 loops=1)

127. 0.014 0.018 ↑ 3.0 19 1

HashAggregate (cost=1.28..1.85 rows=57 width=36) (actual time=0.015..0.018 rows=19 loops=1)

  • Group Key: wc_3.cd_movimento
128. 0.004 0.004 ↑ 1.8 32 1

CTE Scan on with_caixa_vencida wc_3 (cost=0.00..1.14 rows=57 width=4) (actual time=0.000..0.004 rows=32 loops=1)

129. 0.000 0.182 ↓ 0.0 0 1

Hash (cost=15.35..15.35 rows=1 width=36) (actual time=0.182..0.182 rows=0 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
130. 0.001 0.182 ↓ 0.0 0 1

Subquery Scan on wvvv (cost=15.32..15.35 rows=1 width=36) (actual time=0.182..0.182 rows=0 loops=1)

131. 0.001 0.181 ↓ 0.0 0 1

GroupAggregate (cost=15.32..15.34 rows=1 width=36) (actual time=0.181..0.181 rows=0 loops=1)

  • Group Key: wm_7.cd_movimento
132. 0.001 0.180 ↓ 0.0 0 1

Sort (cost=15.32..15.33 rows=1 width=9) (actual time=0.180..0.180 rows=0 loops=1)

  • Sort Key: wm_7.cd_movimento
  • Sort Method: quicksort Memory: 25kB
133. 0.046 0.179 ↓ 0.0 0 1

Hash Join (cost=4.78..15.31 rows=1 width=9) (actual time=0.178..0.179 rows=0 loops=1)

  • Hash Cond: (vv.cd_movimento = wm_7.cd_movimento)
134. 0.111 0.111 ↑ 1.0 307 1

Seq Scan on viagem_valor vv (cost=0.00..9.37 rows=307 width=9) (actual time=0.005..0.111 rows=307 loops=1)

  • Filter: (dt_valor <= (CURRENT_DATE - 1))
135. 0.011 0.022 ↑ 2.2 67 1

Hash (cost=2.94..2.94 rows=147 width=4) (actual time=0.022..0.022 rows=67 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
136. 0.011 0.011 ↑ 2.2 67 1

CTE Scan on with_movimento_vencida wm_7 (cost=0.00..2.94 rows=147 width=4) (actual time=0.001..0.011 rows=67 loops=1)

137.          

CTE with_dados_gerais_vencendo

138. 0.003 0.916 ↓ 2.0 2 1

Nested Loop (cost=34.34..917.34 rows=1 width=60) (actual time=0.556..0.916 rows=2 loops=1)

139. 0.005 0.905 ↓ 2.0 2 1

Nested Loop Anti Join (cost=34.05..913.03 rows=1 width=60) (actual time=0.547..0.905 rows=2 loops=1)

140. 0.005 0.876 ↓ 2.0 2 1

Nested Loop (cost=32.77..910.64 rows=1 width=60) (actual time=0.525..0.876 rows=2 loops=1)

141. 0.581 0.861 ↓ 2.0 2 1

Bitmap Heap Scan on titulo t_1 (cost=32.48..902.32 rows=1 width=54) (actual time=0.514..0.861 rows=2 loops=1)

  • Recheck Cond: ((dt_quitacao IS NULL) OR (dt_quitacao > (CURRENT_DATE - 1)))
  • Filter: (dt_vencimento = (CURRENT_DATE - 1))
  • Rows Removed by Filter: 1,435
  • Heap Blocks: exact=131
142. 0.000 0.280 ↓ 0.0 0 1

BitmapOr (cost=32.48..32.48 rows=1,586 width=0) (actual time=0.280..0.280 rows=0 loops=1)

143. 0.273 0.273 ↑ 1.0 1,412 1

Bitmap Index Scan on idx_titulo_dt_quitacao (cost=0.00..26.98 rows=1,425 width=0) (actual time=0.273..0.273 rows=1,412 loops=1)

  • Index Cond: (dt_quitacao IS NULL)
144. 0.007 0.007 ↑ 6.4 25 1

Bitmap Index Scan on idx_titulo_dt_quitacao (cost=0.00..5.50 rows=161 width=0) (actual time=0.007..0.007 rows=25 loops=1)

  • Index Cond: (dt_quitacao > (CURRENT_DATE - 1))
145. 0.010 0.010 ↑ 1.0 1 2

Index Scan using pk_movimento on movimento m_1 (cost=0.29..8.32 rows=1 width=10) (actual time=0.005..0.005 rows=1 loops=2)

  • Index Cond: (cd_movimento = t_1.cd_movimento)
  • Filter: ((id_tipo = 2) AND (dt_movimento <= (CURRENT_DATE - 1)))
146. 0.006 0.024 ↓ 0.0 0 2

Hash Join (cost=1.28..2.37 rows=2 width=4) (actual time=0.011..0.012 rows=0 loops=2)

  • Hash Cond: (fi__1.cd_pessoa_filial = e__1.cd_pessoa)
147. 0.004 0.004 ↑ 5.0 1 1

Seq Scan on filial fi__1 (cost=0.00..1.05 rows=5 width=4) (actual time=0.004..0.004 rows=1 loops=1)

148. 0.002 0.014 ↓ 0.0 0 2

Hash (cost=1.26..1.26 rows=2 width=8) (actual time=0.007..0.007 rows=0 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
149. 0.005 0.012 ↓ 0.0 0 2

Hash Join (cost=0.20..1.26 rows=2 width=8) (actual time=0.006..0.006 rows=0 loops=2)

  • Hash Cond: (e__1.cd_emprestimo = em__1.cd_emprestimo)
150. 0.001 0.001 ↑ 3.0 1 1

Seq Scan on emprestimo e__1 (cost=0.00..1.03 rows=3 width=8) (actual time=0.001..0.001 rows=1 loops=1)

151. 0.002 0.006 ↓ 0.0 0 2

Hash (cost=0.17..0.17 rows=2 width=8) (actual time=0.003..0.003 rows=0 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
152. 0.004 0.004 ↓ 0.0 0 2

Index Only Scan using emprestimo_movimento_pkey on emprestimo_movimento em__1 (cost=0.13..0.17 rows=2 width=8) (actual time=0.002..0.002 rows=0 loops=2)

  • Index Cond: (cd_movimento = m_1.cd_movimento)
  • Heap Fetches: 0
153. 0.008 0.008 ↑ 1.0 1 2

Index Only Scan using pk_titulo_debito on titulo_debito td_1 (cost=0.29..4.30 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=2)

  • Index Cond: (cd_titulo = t_1.cd_titulo)
  • Heap Fetches: 0
154.          

CTE with_movimento_vencendo

155. 0.006 0.008 ↓ 2.0 2 1

HashAggregate (cost=0.03..0.04 rows=1 width=36) (actual time=0.007..0.008 rows=2 loops=1)

  • Group Key: wdg_2.cd_movimento, CASE WHEN (wdg_2.vl_movimento = '0'::numeric) THEN '1'::numeric ELSE wdg_2.vl_movimento END
156. 0.002 0.002 ↓ 2.0 2 1

CTE Scan on with_dados_gerais_vencendo wdg_2 (cost=0.00..0.02 rows=1 width=36) (actual time=0.002..0.002 rows=2 loops=1)

157.          

CTE with_total_titulo_vencendo

158. 0.003 0.936 ↓ 2.0 2 1

Unique (cost=0.05..0.07 rows=1 width=44) (actual time=0.933..0.936 rows=2 loops=1)

159. 0.007 0.933 ↓ 2.0 2 1

Sort (cost=0.05..0.06 rows=1 width=44) (actual time=0.932..0.933 rows=2 loops=1)

  • Sort Key: wdg_3.cd_movimento, wdg_3.cd_titulo, wdg_3.dt_quitacao, (((((((COALESCE(wdg_3.vl_titulo, '0'::numeric) + COALESCE(wdg_3.vl_juro, '0'::numeric)) + COALESCE(wdg_3.vl_multa, '0'::numeric)) + COALESCE(wdg_3.vl_emolumento, '0'::numeric)) + COALESCE(wdg_3.vl_acrescimo, '0'::numeric)) - COALESCE(wdg_3.vl_desconto, '0'::numeric)) - CASE WHEN (wdg_3.dt_quitacao > (CURRENT_DATE - 1)) THEN '0'::numeric ELSE COALESCE(wdg_3.vl_pago, '0'::numeric) END))
  • Sort Method: quicksort Memory: 25kB
160. 0.926 0.926 ↓ 2.0 2 1

CTE Scan on with_dados_gerais_vencendo wdg_3 (cost=0.00..0.04 rows=1 width=44) (actual time=0.563..0.926 rows=2 loops=1)

161.          

CTE with_valores_ctrc_vencendo

162. 0.005 0.095 ↓ 3.0 3 1

Unique (cost=12.58..12.61 rows=1 width=34) (actual time=0.090..0.095 rows=3 loops=1)

163. 0.006 0.090 ↓ 3.0 3 1

Sort (cost=12.58..12.59 rows=1 width=34) (actual time=0.089..0.090 rows=3 loops=1)

  • Sort Key: ct_1.cd_ctrc, cfp_1.cd_movimento, cfpa_1.vl_parcelamento, ct_1.id_tipo, cf_1.id_pedagio, cf_1.vl_pedagio_pago, cfp_1.nr_parcela, cc_1.vl_complemento, cf_1.vl_quebra, cfp_1.id_tipo
  • Sort Method: quicksort Memory: 25kB
164. 0.005 0.084 ↓ 3.0 3 1

Nested Loop Left Join (cost=1.58..12.57 rows=1 width=34) (actual time=0.049..0.084 rows=3 loops=1)

165. 0.007 0.070 ↓ 3.0 3 1

Nested Loop (cost=1.46..12.41 rows=1 width=31) (actual time=0.038..0.070 rows=3 loops=1)

  • Join Filter: (ct_1.cd_ctrc = cf_1.cd_ctrc)
166. 0.006 0.057 ↓ 3.0 3 1

Nested Loop Left Join (cost=1.17..12.03 rows=1 width=28) (actual time=0.031..0.057 rows=3 loops=1)

  • Filter: CASE WHEN (cte_1.cd_ctrc IS NOT NULL) THEN (cte_1.cd_status = 100) ELSE true END
167. 0.008 0.045 ↓ 1.5 3 1

Nested Loop (cost=0.88..10.90 rows=2 width=28) (actual time=0.025..0.045 rows=3 loops=1)

168. 0.006 0.031 ↓ 1.5 3 1

Nested Loop (cost=0.58..10.01 rows=2 width=22) (actual time=0.017..0.031 rows=3 loops=1)

169. 0.003 0.016 ↑ 1.0 3 1

Nested Loop (cost=0.29..8.63 rows=3 width=12) (actual time=0.009..0.016 rows=3 loops=1)

170. 0.001 0.001 ↓ 2.0 2 1

CTE Scan on with_movimento_vencendo wm_8 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.001 rows=2 loops=1)

171. 0.012 0.012 ↑ 1.5 2 2

Index Scan using idx_carta_frete_pagamento_cd_movimento on carta_frete_pagamento cfp_1 (cost=0.29..8.58 rows=3 width=12) (actual time=0.004..0.006 rows=2 loops=2)

  • Index Cond: (cd_movimento = wm_8.cd_movimento)
  • Filter: (COALESCE((dt_recebimento)::timestamp without time zone, dt_troca) <= (CURRENT_DATE - 1))
172. 0.009 0.009 ↑ 1.0 1 3

Index Scan using pk_carta_frete_parcelamento on carta_frete_parcelamento cfpa_1 (cost=0.29..0.46 rows=1 width=14) (actual time=0.003..0.003 rows=1 loops=3)

  • Index Cond: ((cd_ctrc = cfp_1.cd_ctrc) AND (id_tipo = cfp_1.id_tipo) AND (nr_parcela = cfp_1.nr_parcela))
173. 0.006 0.006 ↑ 1.0 1 3

Index Scan using pk_ctrc on ctrc ct_1 (cost=0.29..0.44 rows=1 width=6) (actual time=0.002..0.002 rows=1 loops=3)

  • Index Cond: (cd_ctrc = cfpa_1.cd_ctrc)
174. 0.006 0.006 ↑ 1.0 1 3

Index Scan using pk_ctrc_cte on ctrc_cte cte_1 (cost=0.29..0.55 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=3)

  • Index Cond: (cd_ctrc = ct_1.cd_ctrc)
175. 0.006 0.006 ↑ 1.0 1 3

Index Scan using pk_carta_frete on carta_frete cf_1 (cost=0.29..0.37 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=3)

  • Index Cond: (cd_ctrc = cfpa_1.cd_ctrc)
176. 0.009 0.009 ↓ 0.0 0 3

Index Scan using pk_ctrc_complemento on ctrc_complemento cc_1 (cost=0.12..0.14 rows=1 width=7) (actual time=0.003..0.003 rows=0 loops=3)

  • Index Cond: (cd_ctrc = ct_1.cd_ctrc)
177.          

CTE with_ctrc_vencendo

178. 0.004 0.010 ↓ 2.0 2 1

HashAggregate (cost=0.02..0.03 rows=1 width=4) (actual time=0.010..0.010 rows=2 loops=1)

  • Group Key: with_valores_ctrc_vencendo.cd_ctrc
179. 0.006 0.006 ↓ 3.0 3 1

CTE Scan on with_valores_ctrc_vencendo (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.006 rows=3 loops=1)

180.          

CTE with_caixa_vencendo

181. 0.003 0.010 ↓ 0.0 0 1

Nested Loop (cost=0.29..8.34 rows=1 width=14) (actual time=0.010..0.010 rows=0 loops=1)

182. 0.001 0.001 ↓ 2.0 2 1

CTE Scan on with_movimento_vencendo wm_9 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.001 rows=2 loops=1)

183. 0.006 0.006 ↓ 0.0 0 2

Index Scan using idx_caixa_cd_movimento on caixa cx_1 (cost=0.29..8.31 rows=1 width=14) (actual time=0.003..0.003 rows=0 loops=2)

  • Index Cond: (cd_movimento = wm_9.cd_movimento)
  • Filter: ((dt_lancamento)::date <= (CURRENT_DATE - 1))
184.          

CTE with_vencendo

185. 0.013 1.962 ↑ 1.0 1 1

Aggregate (cost=65.64..65.65 rows=1 width=192) (actual time=1.961..1.962 rows=1 loops=1)

186. 0.003 1.949 ↓ 2.0 2 1

Nested Loop Left Join (cost=65.15..65.60 rows=1 width=208) (actual time=1.927..1.949 rows=2 loops=1)

  • Join Filter: (wm_15.cd_movimento = wtt_3.cd_movimento)
187. 0.002 1.792 ↓ 2.0 2 1

Nested Loop Left Join (cost=54.57..54.98 rows=1 width=180) (actual time=1.770..1.792 rows=2 loops=1)

  • Join Filter: (wc_7.cd_movimento = wtt_3.cd_movimento)
188. 0.003 1.788 ↓ 2.0 2 1

Merge Left Join (cost=54.55..54.92 rows=1 width=176) (actual time=1.767..1.788 rows=2 loops=1)

  • Merge Cond: (wtt_3.cd_movimento = em_1.cd_movimento)
189. 0.004 1.777 ↓ 2.0 2 1

Nested Loop Left Join (cost=52.33..52.65 rows=1 width=172) (actual time=1.757..1.777 rows=2 loops=1)

  • Join Filter: (wm_13.cd_movimento = wtt_3.cd_movimento)
190. 0.004 1.741 ↓ 2.0 2 1

Nested Loop Left Join (cost=49.47..49.76 rows=1 width=168) (actual time=1.722..1.741 rows=2 loops=1)

  • Join Filter: (wtt_5.cd_titulo = wtt_3.cd_titulo)
  • Rows Removed by Join Filter: 2
191. 0.004 0.997 ↓ 2.0 2 1

Nested Loop Left Join (cost=42.42..42.62 rows=1 width=140) (actual time=0.990..0.997 rows=2 loops=1)

  • Join Filter: (wtt_4.cd_titulo = wtt_3.cd_titulo)
192. 0.003 0.969 ↓ 2.0 2 1

Merge Left Join (cost=34.12..34.21 rows=1 width=44) (actual time=0.968..0.969 rows=2 loops=1)

  • Merge Cond: (wtt_3.cd_movimento = im_1.cd_movimento)
193. 0.005 0.943 ↓ 2.0 2 1

Sort (cost=0.03..0.04 rows=1 width=40) (actual time=0.942..0.943 rows=2 loops=1)

  • Sort Key: wtt_3.cd_movimento
  • Sort Method: quicksort Memory: 25kB
194. 0.938 0.938 ↓ 2.0 2 1

CTE Scan on with_total_titulo_vencendo wtt_3 (cost=0.00..0.02 rows=1 width=40) (actual time=0.935..0.938 rows=2 loops=1)

195. 0.000 0.023 ↓ 0.0 0 1

Unique (cost=34.09..34.11 rows=4 width=4) (actual time=0.023..0.023 rows=0 loops=1)

196. 0.003 0.023 ↓ 0.0 0 1

Sort (cost=34.09..34.10 rows=4 width=4) (actual time=0.023..0.023 rows=0 loops=1)

  • Sort Key: im_1.cd_movimento
  • Sort Method: quicksort Memory: 25kB
197. 0.001 0.020 ↓ 0.0 0 1

Nested Loop (cost=21.26..34.05 rows=4 width=4) (actual time=0.019..0.020 rows=0 loops=1)

198. 0.004 0.019 ↓ 0.0 0 1

Nested Loop (cost=21.11..31.91 rows=11 width=8) (actual time=0.019..0.019 rows=0 loops=1)

199. 0.009 0.009 ↓ 2.0 2 1

CTE Scan on with_movimento_vencendo wm_11 (cost=0.00..0.02 rows=1 width=4) (actual time=0.008..0.009 rows=2 loops=1)

200. 0.004 0.006 ↓ 0.0 0 2

Bitmap Heap Scan on investimento_movimento im_1 (cost=21.11..31.78 rows=11 width=8) (actual time=0.003..0.003 rows=0 loops=2)

  • Recheck Cond: (cd_movimento = wm_11.cd_movimento)
201. 0.002 0.002 ↓ 0.0 0 2

Bitmap Index Scan on pk_investimento_movimento (cost=0.00..21.11 rows=11 width=0) (actual time=0.001..0.001 rows=0 loops=2)

  • Index Cond: (cd_movimento = wm_11.cd_movimento)
202. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_investimento on investimento inv_1 (cost=0.15..0.19 rows=1 width=4) (never executed)

  • Index Cond: (cd_investimento = im_1.cd_investimento)
  • Filter: (dt_compra <= (CURRENT_DATE - 1))
203. 0.000 0.024 ↓ 0.0 0 2

Nested Loop (cost=8.30..8.40 rows=1 width=100) (actual time=0.012..0.012 rows=0 loops=2)

  • Join Filter: (wm_10.cd_movimento = wc_4.cd_movimento)
204. 0.006 0.008 ↓ 2.0 2 2

Nested Loop (cost=0.00..0.05 rows=1 width=76) (actual time=0.002..0.004 rows=2 loops=2)

  • Join Filter: (wtt_4.cd_movimento = wm_10.cd_movimento)
  • Rows Removed by Join Filter: 2
205. 0.002 0.002 ↓ 2.0 2 2

CTE Scan on with_total_titulo_vencendo wtt_4 (cost=0.00..0.02 rows=1 width=40) (actual time=0.000..0.001 rows=2 loops=2)

206. 0.000 0.000 ↓ 2.0 2 4

CTE Scan on with_movimento_vencendo wm_10 (cost=0.00..0.02 rows=1 width=36) (actual time=0.000..0.000 rows=2 loops=4)

207. 0.004 0.016 ↓ 0.0 0 4

GroupAggregate (cost=8.30..8.33 rows=1 width=36) (actual time=0.004..0.004 rows=0 loops=4)

  • Group Key: wc_4.cd_movimento
208. 0.001 0.012 ↓ 0.0 0 4

Sort (cost=8.30..8.31 rows=1 width=22) (actual time=0.003..0.003 rows=0 loops=4)

  • Sort Key: wc_4.cd_movimento
  • Sort Method: quicksort Memory: 25kB
209. 0.000 0.011 ↓ 0.0 0 1

Nested Loop (cost=0.14..8.29 rows=1 width=22) (actual time=0.011..0.011 rows=0 loops=1)

210. 0.011 0.011 ↓ 0.0 0 1

CTE Scan on with_caixa_vencendo wc_4 (cost=0.00..0.03 rows=1 width=26) (actual time=0.011..0.011 rows=0 loops=1)

  • Filter: ((cd_historico)::text <> '28'::text)
211. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_historico_caixa on historico_caixa hc_1 (cost=0.14..8.18 rows=1 width=4) (never executed)

  • Index Cond: (cd_historico = wc_4.cd_historico)
  • Filter: ((id_tributo_federal = 0) AND (id_icms_terceiro = 0) AND (id_seguro_carga = 0) AND (id_inss_patronal = 0) AND (id_ipva = 0) AND (id_seguro_frota = 0))
212. 0.036 0.740 ↓ 2.0 2 2

GroupAggregate (cost=7.05..7.12 rows=1 width=104) (actual time=0.366..0.370 rows=2 loops=2)

  • Group Key: wtt_5.cd_titulo, wm_12.vl_movimento, wtt_5.vl_total_titulo
213. 0.006 0.704 ↓ 3.0 3 2

Sort (cost=7.05..7.05 rows=1 width=212) (actual time=0.352..0.352 rows=3 loops=2)

  • Sort Key: wtt_5.cd_titulo, wm_12.vl_movimento, wtt_5.vl_total_titulo
  • Sort Method: quicksort Memory: 25kB
214. 0.003 0.698 ↓ 3.0 3 1

Nested Loop (cost=0.03..7.04 rows=1 width=212) (actual time=0.215..0.698 rows=3 loops=1)

  • Join Filter: (wtt_5.cd_movimento = wm_12.cd_movimento)
  • Rows Removed by Join Filter: 3
215. 0.005 0.692 ↓ 3.0 3 1

Nested Loop Left Join (cost=0.03..7.00 rows=1 width=184) (actual time=0.213..0.692 rows=3 loops=1)

  • Join Filter: (wvc_2.cd_movimento = wtt_5.cd_movimento)
  • Rows Removed by Join Filter: 3
216. 0.001 0.001 ↓ 2.0 2 1

CTE Scan on with_total_titulo_vencendo wtt_5 (cost=0.00..0.02 rows=1 width=40) (actual time=0.000..0.001 rows=2 loops=1)

217. 0.006 0.686 ↓ 3.0 3 2

Nested Loop Left Join (cost=0.03..6.97 rows=1 width=148) (actual time=0.140..0.343 rows=3 loops=2)

  • Join Filter: (wc_5.cd_ctrc = wvc_2.cd_ctrc)
218. 0.006 0.392 ↓ 3.0 3 2

Nested Loop Left Join (cost=0.00..3.31 rows=1 width=120) (actual time=0.097..0.196 rows=3 loops=2)

  • Join Filter: (wc_6.cd_ctrc = wvc_2.cd_ctrc)
219. 0.104 0.104 ↓ 3.0 3 2

CTE Scan on with_valores_ctrc_vencendo wvc_2 (cost=0.00..0.02 rows=1 width=88) (actual time=0.045..0.052 rows=3 loops=2)

220. 0.018 0.282 ↓ 0.0 0 6

Nested Loop (cost=0.00..3.28 rows=1 width=36) (actual time=0.047..0.047 rows=0 loops=6)

  • Join Filter: (cfvp_3.cd_ctrc = wc_6.cd_ctrc)
  • Rows Removed by Join Filter: 4
221. 0.012 0.012 ↓ 2.0 2 6

CTE Scan on with_ctrc_vencendo wc_6 (cost=0.00..0.02 rows=1 width=4) (actual time=0.002..0.002 rows=2 loops=6)

222. 0.252 0.252 ↑ 1.0 2 12

Seq Scan on carta_frete_vale_pedagio cfvp_3 (cost=0.00..3.24 rows=2 width=36) (actual time=0.001..0.021 rows=2 loops=12)

  • Filter: (id_antecipado = '1'::smallint)
  • Rows Removed by Filter: 97
223. 0.093 0.288 ↓ 0.0 0 6

Hash Join (cost=0.03..3.64 rows=1 width=36) (actual time=0.048..0.048 rows=0 loops=6)

  • Hash Cond: (cfvp_2.cd_ctrc = wc_5.cd_ctrc)
224. 0.192 0.192 ↑ 1.0 97 6

Seq Scan on carta_frete_vale_pedagio cfvp_2 (cost=0.00..3.24 rows=97 width=36) (actual time=0.002..0.032 rows=97 loops=6)

  • Filter: (id_antecipado = '0'::smallint)
  • Rows Removed by Filter: 2
225. 0.002 0.003 ↓ 2.0 2 1

Hash (cost=0.02..0.02 rows=1 width=4) (actual time=0.002..0.003 rows=2 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
226. 0.001 0.001 ↓ 2.0 2 1

CTE Scan on with_ctrc_vencendo wc_5 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=2 loops=1)

227. 0.003 0.003 ↓ 2.0 2 3

CTE Scan on with_movimento_vencendo wm_12 (cost=0.00..0.02 rows=1 width=36) (actual time=0.000..0.001 rows=2 loops=3)

228. 0.000 0.032 ↓ 0.0 0 2

Unique (cost=2.86..2.86 rows=1 width=4) (actual time=0.016..0.016 rows=0 loops=2)

229. 0.002 0.032 ↓ 0.0 0 2

Sort (cost=2.86..2.86 rows=1 width=4) (actual time=0.016..0.016 rows=0 loops=2)

  • Sort Key: wm_13.cd_movimento
  • Sort Method: quicksort Memory: 25kB
230. 0.003 0.030 ↓ 0.0 0 1

Nested Loop (cost=1.09..2.85 rows=1 width=4) (actual time=0.030..0.030 rows=0 loops=1)

  • Join Filter: (vpm_1.cd_movimento = wm_13.cd_movimento)
  • Rows Removed by Join Filter: 4
231. 0.007 0.027 ↓ 2.0 2 1

Hash Join (cost=1.09..2.82 rows=1 width=4) (actual time=0.024..0.027 rows=2 loops=1)

  • Hash Cond: (vp_1.cd_veiculo = vpm_1.cd_veiculo)
232. 0.015 0.015 ↓ 1.2 13 1

Seq Scan on veiculo_proprio vp_1 (cost=0.00..1.66 rows=11 width=4) (actual time=0.008..0.015 rows=13 loops=1)

  • Filter: (COALESCE(dt_aquisicao, CURRENT_DATE) <= (CURRENT_DATE - 1))
  • Rows Removed by Filter: 20
233. 0.002 0.005 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=8) (actual time=0.005..0.005 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
234. 0.003 0.003 ↑ 1.0 4 1

Seq Scan on veiculo_proprio_movimento vpm_1 (cost=0.00..1.04 rows=4 width=8) (actual time=0.002..0.003 rows=4 loops=1)

235. 0.000 0.000 ↓ 2.0 2 2

CTE Scan on with_movimento_vencendo wm_13 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.000 rows=2 loops=2)

236. 0.000 0.008 ↓ 0.0 0 1

Unique (cost=2.23..2.23 rows=2 width=4) (actual time=0.008..0.008 rows=0 loops=1)

237. 0.002 0.008 ↓ 0.0 0 1

Sort (cost=2.23..2.23 rows=2 width=4) (actual time=0.008..0.008 rows=0 loops=1)

  • Sort Key: em_1.cd_movimento
  • Sort Method: quicksort Memory: 25kB
238. 0.001 0.006 ↓ 0.0 0 1

Nested Loop (cost=0.00..2.22 rows=2 width=4) (actual time=0.006..0.006 rows=0 loops=1)

  • Join Filter: (em_1.cd_emprestimo = e_1.cd_emprestimo)
239. 0.002 0.005 ↓ 0.0 0 1

Nested Loop (cost=0.00..1.09 rows=2 width=8) (actual time=0.005..0.005 rows=0 loops=1)

  • Join Filter: (em_1.cd_movimento = wm_14.cd_movimento)
  • Rows Removed by Join Filter: 6
240. 0.001 0.001 ↓ 2.0 2 1

CTE Scan on with_movimento_vencendo wm_14 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.001 rows=2 loops=1)

241. 0.002 0.002 ↑ 1.0 3 2

Seq Scan on emprestimo_movimento em_1 (cost=0.00..1.03 rows=3 width=8) (actual time=0.001..0.001 rows=3 loops=2)

242. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.00..1.07 rows=3 width=4) (never executed)

243. 0.000 0.000 ↓ 0.0 0

Seq Scan on emprestimo e_1 (cost=0.00..1.05 rows=3 width=4) (never executed)

  • Filter: (dt_contrato <= (CURRENT_DATE - 1))
244. 0.002 0.002 ↓ 0.0 0 2

HashAggregate (cost=0.02..0.03 rows=1 width=36) (actual time=0.001..0.001 rows=0 loops=2)

  • Group Key: wc_7.cd_movimento
245. 0.000 0.000 ↓ 0.0 0 1

CTE Scan on with_caixa_vencendo wc_7 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.000 rows=0 loops=1)

246. 0.000 0.154 ↓ 0.0 0 2

GroupAggregate (cost=10.58..10.60 rows=1 width=36) (actual time=0.077..0.077 rows=0 loops=2)

  • Group Key: wm_15.cd_movimento
247. 0.001 0.154 ↓ 0.0 0 2

Sort (cost=10.58..10.58 rows=1 width=9) (actual time=0.077..0.077 rows=0 loops=2)

  • Sort Key: wm_15.cd_movimento
  • Sort Method: quicksort Memory: 25kB
248. 0.051 0.153 ↓ 0.0 0 1

Hash Join (cost=0.03..10.57 rows=1 width=9) (actual time=0.153..0.153 rows=0 loops=1)

  • Hash Cond: (vv_1.cd_movimento = wm_15.cd_movimento)
249. 0.100 0.100 ↑ 1.0 307 1

Seq Scan on viagem_valor vv_1 (cost=0.00..9.37 rows=307 width=9) (actual time=0.003..0.100 rows=307 loops=1)

  • Filter: (dt_valor <= (CURRENT_DATE - 1))
250. 0.001 0.002 ↓ 2.0 2 1

Hash (cost=0.02..0.02 rows=1 width=4) (actual time=0.002..0.002 rows=2 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
251. 0.001 0.001 ↓ 2.0 2 1

CTE Scan on with_movimento_vencendo wm_15 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=2 loops=1)

252.          

CTE with_dados_gerais_a_vencer_periodo

253. 0.249 4.282 ↓ 80.3 241 1

Nested Loop Anti Join (cost=34.35..1,079.69 rows=3 width=60) (actual time=0.112..4.282 rows=241 loops=1)

254. 0.263 3.069 ↓ 80.3 241 1

Nested Loop (cost=33.07..1,075.08 rows=3 width=60) (actual time=0.096..3.069 rows=241 loops=1)

255. 0.598 2.324 ↓ 30.1 241 1

Nested Loop (cost=32.78..1,009.82 rows=8 width=54) (actual time=0.088..2.324 rows=241 loops=1)

256. 0.795 0.848 ↓ 35.1 878 1

Bitmap Heap Scan on titulo t_2 (cost=32.49..918.19 rows=25 width=54) (actual time=0.069..0.848 rows=878 loops=1)

  • Recheck Cond: ((dt_quitacao IS NULL) OR (dt_quitacao > (CURRENT_DATE - 1)))
  • Filter: (((dt_vencimento > (CURRENT_DATE - 1)) AND (dt_vencimento <= ((CURRENT_DATE - 1) + 60))) OR (dt_vencimento IS NULL))
  • Rows Removed by Filter: 559
  • Heap Blocks: exact=131
257. 0.000 0.053 ↓ 0.0 0 1

BitmapOr (cost=32.49..32.49 rows=1,586 width=0) (actual time=0.053..0.053 rows=0 loops=1)

258. 0.048 0.048 ↑ 1.0 1,412 1

Bitmap Index Scan on idx_titulo_dt_quitacao (cost=0.00..26.98 rows=1,425 width=0) (actual time=0.048..0.048 rows=1,412 loops=1)

  • Index Cond: (dt_quitacao IS NULL)
259. 0.005 0.005 ↑ 6.4 25 1

Bitmap Index Scan on idx_titulo_dt_quitacao (cost=0.00..5.50 rows=161 width=0) (actual time=0.005..0.005 rows=25 loops=1)

  • Index Cond: (dt_quitacao > (CURRENT_DATE - 1))
260. 0.878 0.878 ↓ 0.0 0 878

Index Only Scan using pk_titulo_debito on titulo_debito td_2 (cost=0.29..3.66 rows=1 width=4) (actual time=0.001..0.001 rows=0 loops=878)

  • Index Cond: (cd_titulo = t_2.cd_titulo)
  • Heap Fetches: 0
261. 0.482 0.482 ↑ 1.0 1 241

Index Scan using pk_movimento on movimento m_2 (cost=0.29..8.16 rows=1 width=10) (actual time=0.002..0.002 rows=1 loops=241)

  • Index Cond: (cd_movimento = t_2.cd_movimento)
  • Filter: ((id_tipo = 2) AND (dt_movimento <= (CURRENT_DATE - 1)))
262. 0.236 0.964 ↓ 0.0 0 241

Hash Join (cost=1.28..2.37 rows=2 width=4) (actual time=0.004..0.004 rows=0 loops=241)

  • Hash Cond: (fi__2.cd_pessoa_filial = e__2.cd_pessoa)
263. 0.005 0.005 ↑ 1.2 4 5

Seq Scan on filial fi__2 (cost=0.00..1.05 rows=5 width=4) (actual time=0.001..0.001 rows=4 loops=5)

264. 0.241 0.723 ↓ 0.0 0 241

Hash (cost=1.26..1.26 rows=2 width=8) (actual time=0.003..0.003 rows=0 loops=241)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
265. 0.236 0.482 ↓ 0.0 0 241

Hash Join (cost=0.20..1.26 rows=2 width=8) (actual time=0.002..0.002 rows=0 loops=241)

  • Hash Cond: (e__2.cd_emprestimo = em__2.cd_emprestimo)
266. 0.005 0.005 ↑ 1.0 3 5

Seq Scan on emprestimo e__2 (cost=0.00..1.03 rows=3 width=8) (actual time=0.001..0.001 rows=3 loops=5)

267. 0.000 0.241 ↓ 0.0 0 241

Hash (cost=0.17..0.17 rows=2 width=8) (actual time=0.001..0.001 rows=0 loops=241)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
268. 0.241 0.241 ↓ 0.0 0 241

Index Only Scan using emprestimo_movimento_pkey on emprestimo_movimento em__2 (cost=0.13..0.17 rows=2 width=8) (actual time=0.001..0.001 rows=0 loops=241)

  • Index Cond: (cd_movimento = m_2.cd_movimento)
  • Heap Fetches: 0
269.          

CTE with_movimento_a_vencer_periodo

270. 0.083 0.236 ↓ 70.0 210 1

Unique (cost=0.09..0.11 rows=3 width=36) (actual time=0.131..0.236 rows=210 loops=1)

271. 0.095 0.153 ↓ 80.3 241 1

Sort (cost=0.09..0.10 rows=3 width=36) (actual time=0.131..0.153 rows=241 loops=1)

  • Sort Key: wdg_4.cd_movimento, (CASE WHEN (wdg_4.vl_movimento = '0'::numeric) THEN '1'::numeric ELSE wdg_4.vl_movimento END)
  • Sort Method: quicksort Memory: 36kB
272. 0.058 0.058 ↓ 80.3 241 1

CTE Scan on with_dados_gerais_a_vencer_periodo wdg_4 (cost=0.00..0.07 rows=3 width=36) (actual time=0.002..0.058 rows=241 loops=1)

273.          

CTE with_total_titulo_a_vencer_periodo

274. 0.101 5.025 ↓ 80.3 241 1

Unique (cost=0.15..0.19 rows=3 width=44) (actual time=4.901..5.025 rows=241 loops=1)

275. 0.146 4.924 ↓ 80.3 241 1

Sort (cost=0.15..0.16 rows=3 width=44) (actual time=4.900..4.924 rows=241 loops=1)

  • Sort Key: wdg_5.cd_movimento, wdg_5.cd_titulo, wdg_5.dt_quitacao, (((((((COALESCE(wdg_5.vl_titulo, '0'::numeric) + COALESCE(wdg_5.vl_juro, '0'::numeric)) + COALESCE(wdg_5.vl_multa, '0'::numeric)) + COALESCE(wdg_5.vl_emolumento, '0'::numeric)) + COALESCE(wdg_5.vl_acrescimo, '0'::numeric)) - COALESCE(wdg_5.vl_desconto, '0'::numeric)) - CASE WHEN (wdg_5.dt_quitacao > (CURRENT_DATE - 1)) THEN '0'::numeric ELSE COALESCE(wdg_5.vl_pago, '0'::numeric) END))
  • Sort Method: quicksort Memory: 38kB
276. 4.778 4.778 ↓ 80.3 241 1

CTE Scan on with_dados_gerais_a_vencer_periodo wdg_5 (cost=0.00..0.13 rows=3 width=44) (actual time=0.118..4.778 rows=241 loops=1)

277.          

CTE with_valores_ctrc_a_vencer_periodo

278. 0.338 10.768 ↓ 169.2 677 1

Unique (cost=37.71..37.82 rows=4 width=34) (actual time=10.356..10.768 rows=677 loops=1)

279. 0.496 10.430 ↓ 169.2 677 1

Sort (cost=37.71..37.72 rows=4 width=34) (actual time=10.355..10.430 rows=677 loops=1)

  • Sort Key: ct_2.cd_ctrc, cfp_2.cd_movimento, cfpa_2.vl_parcelamento, ct_2.id_tipo, cf_2.id_pedagio, cf_2.vl_pedagio_pago, cfp_2.nr_parcela, cc_2.vl_complemento, cf_2.vl_quebra, cfp_2.id_tipo
  • Sort Method: quicksort Memory: 77kB
280. 0.550 9.934 ↓ 169.2 677 1

Nested Loop (cost=1.58..37.67 rows=4 width=34) (actual time=0.171..9.934 rows=677 loops=1)

  • Join Filter: (ct_2.cd_ctrc = cf_2.cd_ctrc)
281. 0.151 8.030 ↓ 225.7 677 1

Nested Loop Left Join (cost=1.29..36.52 rows=3 width=31) (actual time=0.164..8.030 rows=677 loops=1)

282. 0.492 7.202 ↓ 225.7 677 1

Nested Loop Left Join (cost=1.17..36.08 rows=3 width=28) (actual time=0.160..7.202 rows=677 loops=1)

  • Filter: CASE WHEN (cte_2.cd_ctrc IS NOT NULL) THEN (cte_2.cd_status = 100) ELSE true END
283. 0.840 5.356 ↓ 112.8 677 1

Nested Loop (cost=0.88..32.68 rows=6 width=28) (actual time=0.154..5.356 rows=677 loops=1)

284. 0.657 3.162 ↓ 96.7 677 1

Nested Loop (cost=0.58..29.58 rows=7 width=22) (actual time=0.146..3.162 rows=677 loops=1)

285. 0.274 1.151 ↓ 84.6 677 1

Nested Loop (cost=0.29..25.89 rows=8 width=12) (actual time=0.138..1.151 rows=677 loops=1)

286. 0.037 0.037 ↓ 70.0 210 1

CTE Scan on with_movimento_a_vencer_periodo wm_16 (cost=0.00..0.06 rows=3 width=4) (actual time=0.000..0.037 rows=210 loops=1)

287. 0.840 0.840 ↑ 1.0 3 210

Index Scan using idx_carta_frete_pagamento_cd_movimento on carta_frete_pagamento cfp_2 (cost=0.29..8.58 rows=3 width=12) (actual time=0.002..0.004 rows=3 loops=210)

  • Index Cond: (cd_movimento = wm_16.cd_movimento)
  • Filter: (COALESCE((dt_recebimento)::timestamp without time zone, dt_troca) <= (CURRENT_DATE - 1))
288. 1.354 1.354 ↑ 1.0 1 677

Index Scan using pk_carta_frete_parcelamento on carta_frete_parcelamento cfpa_2 (cost=0.29..0.46 rows=1 width=14) (actual time=0.002..0.002 rows=1 loops=677)

  • Index Cond: ((cd_ctrc = cfp_2.cd_ctrc) AND (id_tipo = cfp_2.id_tipo) AND (nr_parcela = cfp_2.nr_parcela))
289. 1.354 1.354 ↑ 1.0 1 677

Index Scan using pk_ctrc on ctrc ct_2 (cost=0.29..0.44 rows=1 width=6) (actual time=0.002..0.002 rows=1 loops=677)

  • Index Cond: (cd_ctrc = cfpa_2.cd_ctrc)
290. 1.354 1.354 ↑ 1.0 1 677

Index Scan using pk_ctrc_cte on ctrc_cte cte_2 (cost=0.29..0.55 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=677)

  • Index Cond: (cd_ctrc = ct_2.cd_ctrc)
291. 0.677 0.677 ↓ 0.0 0 677

Index Scan using pk_ctrc_complemento on ctrc_complemento cc_2 (cost=0.12..0.14 rows=1 width=7) (actual time=0.001..0.001 rows=0 loops=677)

  • Index Cond: (cd_ctrc = ct_2.cd_ctrc)
292. 1.354 1.354 ↑ 1.0 1 677

Index Scan using pk_carta_frete on carta_frete cf_2 (cost=0.29..0.37 rows=1 width=15) (actual time=0.002..0.002 rows=1 loops=677)

  • Index Cond: (cd_ctrc = cfpa_2.cd_ctrc)
293.          

CTE with_ctrc_a_vencer_periodo

294. 0.277 0.372 ↓ 119.2 477 1

HashAggregate (cost=0.09..0.13 rows=4 width=4) (actual time=0.290..0.372 rows=477 loops=1)

  • Group Key: with_valores_ctrc_a_vencer_periodo.cd_ctrc
295. 0.095 0.095 ↓ 169.2 677 1

CTE Scan on with_valores_ctrc_a_vencer_periodo (cost=0.00..0.08 rows=4 width=4) (actual time=0.001..0.095 rows=677 loops=1)

296.          

CTE with_caixa_a_vencer_periodo

297. 0.122 0.571 ↓ 133.0 133 1

Nested Loop (cost=0.29..25.03 rows=1 width=14) (actual time=0.028..0.571 rows=133 loops=1)

298. 0.029 0.029 ↓ 70.0 210 1

CTE Scan on with_movimento_a_vencer_periodo wm_17 (cost=0.00..0.06 rows=3 width=4) (actual time=0.000..0.029 rows=210 loops=1)

299. 0.420 0.420 ↑ 1.0 1 210

Index Scan using idx_caixa_cd_movimento on caixa cx_2 (cost=0.29..8.31 rows=1 width=14) (actual time=0.002..0.002 rows=1 loops=210)

  • Index Cond: (cd_movimento = wm_17.cd_movimento)
  • Filter: ((dt_lancamento)::date <= (CURRENT_DATE - 1))
300.          

CTE with_a_vencer_periodo

301. 0.212 42.706 ↑ 1.0 1 1

Aggregate (cost=81.44..81.45 rows=1 width=192) (actual time=42.706..42.706 rows=1 loops=1)

302. 0.113 42.494 ↓ 80.3 241 1

Hash Left Join (cost=80.59..81.33 rows=3 width=208) (actual time=22.677..42.494 rows=241 loops=1)

  • Hash Cond: (wtt_6.cd_movimento = wvc_3.cd_movimento)
303. 0.052 42.231 ↓ 80.3 241 1

Merge Left Join (cost=80.53..81.25 rows=3 width=208) (actual time=22.496..42.231 rows=241 loops=1)

  • Merge Cond: (wtt_6.cd_movimento = wm_23.cd_movimento)
304. 0.057 41.784 ↓ 80.3 241 1

Merge Left Join (cost=69.89..70.56 rows=3 width=176) (actual time=22.098..41.784 rows=241 loops=1)

  • Merge Cond: (wtt_6.cd_movimento = em_2.cd_movimento)
305. 0.054 41.606 ↓ 80.3 241 1

Merge Left Join (cost=67.64..68.19 rows=3 width=172) (actual time=21.980..41.606 rows=241 loops=1)

  • Merge Cond: (wtt_6.cd_movimento = wm_21.cd_movimento)
306. 3.790 41.418 ↓ 80.3 241 1

Nested Loop Left Join (cost=64.72..65.23 rows=3 width=168) (actual time=21.844..41.418 rows=241 loops=1)

  • Join Filter: (wtt_7.cd_titulo = wtt_6.cd_titulo)
  • Rows Removed by Join Filter: 30,960
307. 0.070 20.999 ↓ 80.3 241 1

Merge Left Join (cost=56.42..56.65 rows=3 width=76) (actual time=20.905..20.999 rows=241 loops=1)

  • Merge Cond: (wtt_6.cd_movimento = im_2.cd_movimento)
308. 0.128 20.921 ↓ 80.3 241 1

Sort (cost=8.10..8.11 rows=3 width=72) (actual time=20.894..20.921 rows=241 loops=1)

  • Sort Key: wtt_6.cd_movimento
  • Sort Method: quicksort Memory: 43kB
309. 0.162 20.793 ↓ 80.3 241 1

Merge Left Join (cost=7.78..8.08 rows=3 width=72) (actual time=19.471..20.793 rows=241 loops=1)

  • Merge Cond: (wtt_6.cd_titulo = wtt_8.cd_titulo)
310. 0.089 5.223 ↓ 80.3 241 1

Sort (cost=0.08..0.09 rows=3 width=40) (actual time=5.201..5.223 rows=241 loops=1)

  • Sort Key: wtt_6.cd_titulo
  • Sort Method: quicksort Memory: 37kB
311. 5.134 5.134 ↓ 80.3 241 1

CTE Scan on with_total_titulo_a_vencer_periodo wtt_6 (cost=0.00..0.06 rows=3 width=40) (actual time=4.903..5.134 rows=241 loops=1)

312. 0.098 15.408 ↓ 80.3 241 1

Materialize (cost=7.69..7.94 rows=3 width=36) (actual time=14.265..15.408 rows=241 loops=1)

313. 0.963 15.310 ↓ 80.3 241 1

GroupAggregate (cost=7.69..7.90 rows=3 width=104) (actual time=14.263..15.310 rows=241 loops=1)

  • Group Key: wtt_8.cd_titulo, wm_19.vl_movimento, wtt_8.vl_total_titulo
314. 0.691 14.347 ↓ 275.7 827 1

Sort (cost=7.69..7.70 rows=3 width=212) (actual time=14.248..14.347 rows=827 loops=1)

  • Sort Key: wtt_8.cd_titulo, wm_19.vl_movimento, wtt_8.vl_total_titulo
  • Sort Method: quicksort Memory: 131kB
315. 0.482 13.656 ↓ 275.7 827 1

Nested Loop Left Join (cost=0.59..7.67 rows=3 width=212) (actual time=12.500..13.656 rows=827 loops=1)

  • Join Filter: (wc_9.cd_ctrc = wvc_4.cd_ctrc)
316. 0.317 13.174 ↓ 275.7 827 1

Hash Join (cost=0.46..4.24 rows=3 width=184) (actual time=12.348..13.174 rows=827 loops=1)

  • Hash Cond: (wtt_8.cd_movimento = wm_19.cd_movimento)
317. 0.293 12.517 ↓ 275.7 827 1

Hash Right Join (cost=0.36..4.10 rows=3 width=156) (actual time=12.003..12.517 rows=827 loops=1)

  • Hash Cond: (wvc_4.cd_movimento = wtt_8.cd_movimento)
318. 0.209 12.136 ↓ 169.2 677 1

Hash Right Join (cost=0.26..3.96 rows=4 width=120) (actual time=11.910..12.136 rows=677 loops=1)

  • Hash Cond: (wc_8.cd_ctrc = wvc_4.cd_ctrc)
319. 0.024 0.657 ↓ 4.8 19 1

Hash Join (cost=0.13..3.77 rows=4 width=36) (actual time=0.635..0.657 rows=19 loops=1)

  • Hash Cond: (cfvp_4.cd_ctrc = wc_8.cd_ctrc)
320. 0.036 0.036 ↑ 1.0 97 1

Seq Scan on carta_frete_vale_pedagio cfvp_4 (cost=0.00..3.24 rows=97 width=36) (actual time=0.008..0.036 rows=97 loops=1)

  • Filter: (id_antecipado = '0'::smallint)
  • Rows Removed by Filter: 2
321. 0.071 0.597 ↓ 119.2 477 1

Hash (cost=0.08..0.08 rows=4 width=4) (actual time=0.597..0.597 rows=477 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 25kB
322. 0.526 0.526 ↓ 119.2 477 1

CTE Scan on with_ctrc_a_vencer_periodo wc_8 (cost=0.00..0.08 rows=4 width=4) (actual time=0.291..0.526 rows=477 loops=1)

323. 0.206 11.270 ↓ 169.2 677 1

Hash (cost=0.08..0.08 rows=4 width=88) (actual time=11.270..11.270 rows=677 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 59kB
324. 11.064 11.064 ↓ 169.2 677 1

CTE Scan on with_valores_ctrc_a_vencer_periodo wvc_4 (cost=0.00..0.08 rows=4 width=88) (actual time=10.359..11.064 rows=677 loops=1)

325. 0.045 0.088 ↓ 80.3 241 1

Hash (cost=0.06..0.06 rows=3 width=40) (actual time=0.088..0.088 rows=241 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 20kB
326. 0.043 0.043 ↓ 80.3 241 1

CTE Scan on with_total_titulo_a_vencer_periodo wtt_8 (cost=0.00..0.06 rows=3 width=40) (actual time=0.001..0.043 rows=241 loops=1)

327. 0.042 0.340 ↓ 70.0 210 1

Hash (cost=0.06..0.06 rows=3 width=36) (actual time=0.340..0.340 rows=210 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 18kB
328. 0.298 0.298 ↓ 70.0 210 1

CTE Scan on with_movimento_a_vencer_periodo wm_19 (cost=0.00..0.06 rows=3 width=36) (actual time=0.133..0.298 rows=210 loops=1)

329. 0.000 0.000 ↓ 0.0 0 827

Materialize (cost=0.13..3.39 rows=1 width=36) (actual time=0.000..0.000 rows=0 loops=827)

330. 0.004 0.148 ↓ 0.0 0 1

Hash Join (cost=0.13..3.38 rows=1 width=36) (actual time=0.148..0.148 rows=0 loops=1)

  • Hash Cond: (cfvp_5.cd_ctrc = wc_9.cd_ctrc)
331. 0.020 0.020 ↑ 1.0 2 1

Seq Scan on carta_frete_vale_pedagio cfvp_5 (cost=0.00..3.24 rows=2 width=36) (actual time=0.005..0.020 rows=2 loops=1)

  • Filter: (id_antecipado = '1'::smallint)
  • Rows Removed by Filter: 97
332. 0.065 0.124 ↓ 119.2 477 1

Hash (cost=0.08..0.08 rows=4 width=4) (actual time=0.124..0.124 rows=477 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 25kB
333. 0.059 0.059 ↓ 119.2 477 1

CTE Scan on with_ctrc_a_vencer_periodo wc_9 (cost=0.00..0.08 rows=4 width=4) (actual time=0.000..0.059 rows=477 loops=1)

334. 0.001 0.008 ↓ 0.0 0 1

Unique (cost=48.32..48.37 rows=11 width=4) (actual time=0.008..0.008 rows=0 loops=1)

335. 0.003 0.007 ↓ 0.0 0 1

Sort (cost=48.32..48.34 rows=11 width=4) (actual time=0.007..0.007 rows=0 loops=1)

  • Sort Key: im_2.cd_movimento
  • Sort Method: quicksort Memory: 25kB
336. 0.000 0.004 ↓ 0.0 0 1

Nested Loop (cost=0.25..48.12 rows=11 width=4) (actual time=0.004..0.004 rows=0 loops=1)

337. 0.001 0.004 ↓ 0.0 0 1

Hash Join (cost=0.10..41.51 rows=34 width=8) (actual time=0.004..0.004 rows=0 loops=1)

  • Hash Cond: (im_2.cd_movimento = wm_20.cd_movimento)
338. 0.003 0.003 ↓ 0.0 0 1

Seq Scan on investimento_movimento im_2 (cost=0.00..32.60 rows=2,260 width=8) (actual time=0.003..0.003 rows=0 loops=1)

339. 0.000 0.000 ↓ 0.0 0

Hash (cost=0.06..0.06 rows=3 width=4) (never executed)

340. 0.000 0.000 ↓ 0.0 0

CTE Scan on with_movimento_a_vencer_periodo wm_20 (cost=0.00..0.06 rows=3 width=4) (never executed)

341. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_investimento on investimento inv_2 (cost=0.15..0.19 rows=1 width=4) (never executed)

  • Index Cond: (cd_investimento = im_2.cd_investimento)
  • Filter: (dt_compra <= (CURRENT_DATE - 1))
342. 2.914 16.629 ↓ 129.0 129 241

Materialize (cost=8.30..8.54 rows=1 width=100) (actual time=0.004..0.069 rows=129 loops=241)

343. 3.230 13.715 ↓ 129.0 129 1

Nested Loop (cost=8.30..8.53 rows=1 width=100) (actual time=0.935..13.715 rows=129 loops=1)

  • Join Filter: (wtt_7.cd_movimento = wm_18.cd_movimento)
  • Rows Removed by Join Filter: 26,961
344. 2.830 7.002 ↓ 129.0 129 1

Nested Loop (cost=8.30..8.43 rows=1 width=76) (actual time=0.933..7.002 rows=129 loops=1)

  • Join Filter: (wtt_7.cd_movimento = wc_10.cd_movimento)
  • Rows Removed by Join Filter: 23,971
345. 0.134 1.072 ↓ 100.0 100 1

GroupAggregate (cost=8.30..8.33 rows=1 width=36) (actual time=0.930..1.072 rows=100 loops=1)

  • Group Key: wc_10.cd_movimento
346. 0.037 0.938 ↓ 114.0 114 1

Sort (cost=8.30..8.31 rows=1 width=22) (actual time=0.925..0.938 rows=114 loops=1)

  • Sort Key: wc_10.cd_movimento
  • Sort Method: quicksort Memory: 30kB
347. 0.125 0.901 ↓ 114.0 114 1

Nested Loop (cost=0.14..8.29 rows=1 width=22) (actual time=0.040..0.901 rows=114 loops=1)

348. 0.643 0.643 ↓ 133.0 133 1

CTE Scan on with_caixa_a_vencer_periodo wc_10 (cost=0.00..0.03 rows=1 width=26) (actual time=0.031..0.643 rows=133 loops=1)

  • Filter: ((cd_historico)::text <> '28'::text)
349. 0.133 0.133 ↑ 1.0 1 133

Index Scan using pk_historico_caixa on historico_caixa hc_2 (cost=0.14..8.18 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=133)

  • Index Cond: (cd_historico = wc_10.cd_historico)
  • Filter: ((id_tributo_federal = 0) AND (id_icms_terceiro = 0) AND (id_seguro_carga = 0) AND (id_inss_patronal = 0) AND (id_ipva = 0) AND (id_seguro_frota = 0))
  • Rows Removed by Filter: 0
350. 3.100 3.100 ↓ 80.3 241 100

CTE Scan on with_total_titulo_a_vencer_periodo wtt_7 (cost=0.00..0.06 rows=3 width=40) (actual time=0.000..0.031 rows=241 loops=100)

351. 3.483 3.483 ↓ 70.0 210 129

CTE Scan on with_movimento_a_vencer_periodo wm_18 (cost=0.00..0.06 rows=3 width=36) (actual time=0.000..0.027 rows=210 loops=129)

352. 0.001 0.134 ↓ 2.0 2 1

Unique (cost=2.92..2.93 rows=1 width=4) (actual time=0.133..0.134 rows=2 loops=1)

353. 0.004 0.133 ↓ 2.0 2 1

Sort (cost=2.92..2.93 rows=1 width=4) (actual time=0.132..0.133 rows=2 loops=1)

  • Sort Key: wm_21.cd_movimento
  • Sort Method: quicksort Memory: 25kB
354. 0.044 0.129 ↓ 2.0 2 1

Nested Loop (cost=1.09..2.91 rows=1 width=4) (actual time=0.031..0.129 rows=2 loops=1)

  • Join Filter: (vpm_2.cd_movimento = wm_21.cd_movimento)
  • Rows Removed by Join Filter: 418
355. 0.007 0.029 ↓ 2.0 2 1

Hash Join (cost=1.09..2.82 rows=1 width=4) (actual time=0.027..0.029 rows=2 loops=1)

  • Hash Cond: (vp_2.cd_veiculo = vpm_2.cd_veiculo)
356. 0.016 0.016 ↓ 1.2 13 1

Seq Scan on veiculo_proprio vp_2 (cost=0.00..1.66 rows=11 width=4) (actual time=0.008..0.016 rows=13 loops=1)

  • Filter: (COALESCE(dt_aquisicao, CURRENT_DATE) <= (CURRENT_DATE - 1))
  • Rows Removed by Filter: 20
357. 0.002 0.006 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=8) (actual time=0.006..0.006 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
358. 0.004 0.004 ↑ 1.0 4 1

Seq Scan on veiculo_proprio_movimento vpm_2 (cost=0.00..1.04 rows=4 width=8) (actual time=0.003..0.004 rows=4 loops=1)

359. 0.056 0.056 ↓ 70.0 210 2

CTE Scan on with_movimento_a_vencer_periodo wm_21 (cost=0.00..0.06 rows=3 width=4) (actual time=0.000..0.028 rows=210 loops=2)

360. 0.002 0.121 ↑ 1.0 2 1

Unique (cost=2.25..2.31 rows=2 width=4) (actual time=0.115..0.121 rows=2 loops=1)

361. 0.005 0.119 ↑ 1.0 3 1

Merge Join (cost=2.25..2.31 rows=3 width=4) (actual time=0.115..0.119 rows=3 loops=1)

  • Merge Cond: (em_2.cd_movimento = wm_22.cd_movimento)
362. 0.002 0.014 ↑ 1.0 3 1

Sort (cost=2.16..2.17 rows=3 width=4) (actual time=0.014..0.014 rows=3 loops=1)

  • Sort Key: em_2.cd_movimento
  • Sort Method: quicksort Memory: 25kB
363. 0.005 0.012 ↑ 1.0 3 1

Hash Join (cost=1.09..2.14 rows=3 width=4) (actual time=0.011..0.012 rows=3 loops=1)

  • Hash Cond: (em_2.cd_emprestimo = e_2.cd_emprestimo)
364. 0.002 0.002 ↑ 1.0 3 1

Seq Scan on emprestimo_movimento em_2 (cost=0.00..1.03 rows=3 width=8) (actual time=0.001..0.002 rows=3 loops=1)

365. 0.002 0.005 ↑ 1.0 3 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
366. 0.003 0.003 ↑ 1.0 3 1

Seq Scan on emprestimo e_2 (cost=0.00..1.05 rows=3 width=4) (actual time=0.003..0.003 rows=3 loops=1)

  • Filter: (dt_contrato <= (CURRENT_DATE - 1))
367. 0.048 0.100 ↓ 2.7 8 1

Sort (cost=0.08..0.09 rows=3 width=4) (actual time=0.099..0.100 rows=8 loops=1)

  • Sort Key: wm_22.cd_movimento
  • Sort Method: quicksort Memory: 34kB
368. 0.052 0.052 ↓ 70.0 210 1

CTE Scan on with_movimento_a_vencer_periodo wm_22 (cost=0.00..0.06 rows=3 width=4) (actual time=0.001..0.052 rows=210 loops=1)

369. 0.001 0.395 ↓ 0.0 0 1

GroupAggregate (cost=10.64..10.66 rows=1 width=36) (actual time=0.395..0.395 rows=0 loops=1)

  • Group Key: wm_23.cd_movimento
370. 0.002 0.394 ↓ 0.0 0 1

Sort (cost=10.64..10.65 rows=1 width=9) (actual time=0.394..0.394 rows=0 loops=1)

  • Sort Key: wm_23.cd_movimento
  • Sort Method: quicksort Memory: 25kB
371. 0.058 0.392 ↓ 0.0 0 1

Hash Join (cost=0.10..10.63 rows=1 width=9) (actual time=0.392..0.392 rows=0 loops=1)

  • Hash Cond: (vv_2.cd_movimento = wm_23.cd_movimento)
372. 0.166 0.166 ↑ 1.0 307 1

Seq Scan on viagem_valor vv_2 (cost=0.00..9.37 rows=307 width=9) (actual time=0.004..0.166 rows=307 loops=1)

  • Filter: (dt_valor <= (CURRENT_DATE - 1))
373. 0.106 0.168 ↓ 70.0 210 1

Hash (cost=0.06..0.06 rows=3 width=4) (actual time=0.168..0.168 rows=210 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 16kB
374. 0.062 0.062 ↓ 70.0 210 1

CTE Scan on with_movimento_a_vencer_periodo wm_23 (cost=0.00..0.06 rows=3 width=4) (actual time=0.001..0.062 rows=210 loops=1)

375. 0.020 0.150 ↓ 117.0 117 1

Hash (cost=0.04..0.04 rows=1 width=4) (actual time=0.150..0.150 rows=117 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 13kB
376. 0.031 0.130 ↓ 117.0 117 1

Subquery Scan on wvc_3 (cost=0.02..0.04 rows=1 width=4) (actual time=0.081..0.130 rows=117 loops=1)

377. 0.071 0.099 ↓ 117.0 117 1

HashAggregate (cost=0.02..0.03 rows=1 width=36) (actual time=0.080..0.099 rows=117 loops=1)

  • Group Key: wc_11.cd_movimento
378. 0.028 0.028 ↓ 133.0 133 1

CTE Scan on with_caixa_a_vencer_periodo wc_11 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.028 rows=133 loops=1)

379.          

CTE with_dados_gerais_a_vencer_maior

380. 0.172 3.572 ↓ 248.0 248 1

Nested Loop Anti Join (cost=34.35..968.08 rows=1 width=60) (actual time=0.152..3.572 rows=248 loops=1)

381. 0.160 1.912 ↓ 248.0 248 1

Nested Loop (cost=33.06..965.68 rows=1 width=60) (actual time=0.126..1.912 rows=248 loops=1)

382. 0.309 1.256 ↓ 82.7 248 1

Nested Loop (cost=32.77..940.73 rows=3 width=54) (actual time=0.113..1.256 rows=248 loops=1)

383. 0.638 0.695 ↓ 31.5 252 1

Bitmap Heap Scan on titulo t_3 (cost=32.48..906.29 rows=8 width=54) (actual time=0.103..0.695 rows=252 loops=1)

  • Recheck Cond: ((dt_quitacao IS NULL) OR (dt_quitacao > (CURRENT_DATE - 1)))
  • Filter: (dt_vencimento > ((CURRENT_DATE - 1) + 60))
  • Rows Removed by Filter: 1,185
  • Heap Blocks: exact=131
384. 0.002 0.057 ↓ 0.0 0 1

BitmapOr (cost=32.48..32.48 rows=1,586 width=0) (actual time=0.057..0.057 rows=0 loops=1)

385. 0.050 0.050 ↑ 1.0 1,412 1

Bitmap Index Scan on idx_titulo_dt_quitacao (cost=0.00..26.98 rows=1,425 width=0) (actual time=0.050..0.050 rows=1,412 loops=1)

  • Index Cond: (dt_quitacao IS NULL)
386. 0.005 0.005 ↑ 6.4 25 1

Bitmap Index Scan on idx_titulo_dt_quitacao (cost=0.00..5.50 rows=161 width=0) (actual time=0.005..0.005 rows=25 loops=1)

  • Index Cond: (dt_quitacao > (CURRENT_DATE - 1))
387. 0.252 0.252 ↑ 1.0 1 252

Index Only Scan using pk_titulo_debito on titulo_debito td_3 (cost=0.29..4.30 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=252)

  • Index Cond: (cd_titulo = t_3.cd_titulo)
  • Heap Fetches: 0
388. 0.496 0.496 ↑ 1.0 1 248

Index Scan using pk_movimento on movimento m_3 (cost=0.29..8.32 rows=1 width=10) (actual time=0.002..0.002 rows=1 loops=248)

  • Index Cond: (cd_movimento = t_3.cd_movimento)
  • Filter: ((id_tipo = 2) AND (dt_movimento <= (CURRENT_DATE - 1)))
389. 0.413 1.488 ↓ 0.0 0 248

Hash Join (cost=1.28..2.37 rows=2 width=4) (actual time=0.006..0.006 rows=0 loops=248)

  • Hash Cond: (fi__3.cd_pessoa_filial = e__3.cd_pessoa)
390. 0.083 0.083 ↑ 1.0 5 83

Seq Scan on filial fi__3 (cost=0.00..1.05 rows=5 width=4) (actual time=0.001..0.001 rows=5 loops=83)

391. 0.248 0.992 ↑ 2.0 1 248

Hash (cost=1.26..1.26 rows=2 width=8) (actual time=0.004..0.004 rows=1 loops=248)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
392. 0.413 0.744 ↑ 2.0 1 248

Hash Join (cost=0.20..1.26 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=248)

  • Hash Cond: (e__3.cd_emprestimo = em__3.cd_emprestimo)
393. 0.083 0.083 ↑ 1.0 3 83

Seq Scan on emprestimo e__3 (cost=0.00..1.03 rows=3 width=8) (actual time=0.001..0.001 rows=3 loops=83)

394. 0.000 0.248 ↑ 2.0 1 248

Hash (cost=0.17..0.17 rows=2 width=8) (actual time=0.001..0.001 rows=1 loops=248)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
395. 0.248 0.248 ↑ 2.0 1 248

Index Only Scan using emprestimo_movimento_pkey on emprestimo_movimento em__3 (cost=0.13..0.17 rows=2 width=8) (actual time=0.001..0.001 rows=1 loops=248)

  • Index Cond: (cd_movimento = m_3.cd_movimento)
  • Heap Fetches: 0
396.          

CTE with_movimento_a_vencer_maior

397. 0.122 0.187 ↓ 22.0 22 1

HashAggregate (cost=0.03..0.04 rows=1 width=36) (actual time=0.175..0.187 rows=22 loops=1)

  • Group Key: wdg_6.cd_movimento, CASE WHEN (wdg_6.vl_movimento = '0'::numeric) THEN '1'::numeric ELSE wdg_6.vl_movimento END
398. 0.065 0.065 ↓ 248.0 248 1

CTE Scan on with_dados_gerais_a_vencer_maior wdg_6 (cost=0.00..0.02 rows=1 width=36) (actual time=0.002..0.065 rows=248 loops=1)

399.          

CTE with_total_titulo_a_vencer_maior

400. 0.084 4.306 ↓ 248.0 248 1

Unique (cost=0.05..0.07 rows=1 width=44) (actual time=4.202..4.306 rows=248 loops=1)

401. 0.141 4.222 ↓ 248.0 248 1

Sort (cost=0.05..0.06 rows=1 width=44) (actual time=4.201..4.222 rows=248 loops=1)

  • Sort Key: wdg_7.cd_movimento, wdg_7.cd_titulo, wdg_7.dt_quitacao, (((((((COALESCE(wdg_7.vl_titulo, '0'::numeric) + COALESCE(wdg_7.vl_juro, '0'::numeric)) + COALESCE(wdg_7.vl_multa, '0'::numeric)) + COALESCE(wdg_7.vl_emolumento, '0'::numeric)) + COALESCE(wdg_7.vl_acrescimo, '0'::numeric)) - COALESCE(wdg_7.vl_desconto, '0'::numeric)) - CASE WHEN (wdg_7.dt_quitacao > (CURRENT_DATE - 1)) THEN '0'::numeric ELSE COALESCE(wdg_7.vl_pago, '0'::numeric) END))
  • Sort Method: quicksort Memory: 36kB
402. 4.081 4.081 ↓ 248.0 248 1

CTE Scan on with_dados_gerais_a_vencer_maior wdg_7 (cost=0.00..0.04 rows=1 width=44) (actual time=0.160..4.081 rows=248 loops=1)

403.          

CTE with_valores_ctrc_a_vencer_maior

404. 0.000 0.087 ↓ 0.0 0 1

Unique (cost=12.58..12.61 rows=1 width=34) (actual time=0.087..0.087 rows=0 loops=1)

405. 0.031 0.087 ↓ 0.0 0 1

Sort (cost=12.58..12.59 rows=1 width=34) (actual time=0.087..0.087 rows=0 loops=1)

  • Sort Key: ct_3.cd_ctrc, cfp_3.cd_movimento, cfpa_3.vl_parcelamento, ct_3.id_tipo, cf_3.id_pedagio, cf_3.vl_pedagio_pago, cfp_3.nr_parcela, cc_3.vl_complemento, cf_3.vl_quebra, cfp_3.id_tipo
  • Sort Method: quicksort Memory: 25kB
406. 0.000 0.056 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.58..12.57 rows=1 width=34) (actual time=0.056..0.056 rows=0 loops=1)

407. 0.001 0.056 ↓ 0.0 0 1

Nested Loop (cost=1.46..12.41 rows=1 width=31) (actual time=0.056..0.056 rows=0 loops=1)

  • Join Filter: (ct_3.cd_ctrc = cf_3.cd_ctrc)
408. 0.000 0.055 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.17..12.03 rows=1 width=28) (actual time=0.055..0.055 rows=0 loops=1)

  • Filter: CASE WHEN (cte_3.cd_ctrc IS NOT NULL) THEN (cte_3.cd_status = 100) ELSE true END
409. 0.001 0.055 ↓ 0.0 0 1

Nested Loop (cost=0.88..10.90 rows=2 width=28) (actual time=0.055..0.055 rows=0 loops=1)

410. 0.000 0.054 ↓ 0.0 0 1

Nested Loop (cost=0.58..10.01 rows=2 width=22) (actual time=0.054..0.054 rows=0 loops=1)

411. 0.007 0.054 ↓ 0.0 0 1

Nested Loop (cost=0.29..8.63 rows=3 width=12) (actual time=0.054..0.054 rows=0 loops=1)

412. 0.003 0.003 ↓ 22.0 22 1

CTE Scan on with_movimento_a_vencer_maior wm_24 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.003 rows=22 loops=1)

413. 0.044 0.044 ↓ 0.0 0 22

Index Scan using idx_carta_frete_pagamento_cd_movimento on carta_frete_pagamento cfp_3 (cost=0.29..8.58 rows=3 width=12) (actual time=0.002..0.002 rows=0 loops=22)

  • Index Cond: (cd_movimento = wm_24.cd_movimento)
  • Filter: (COALESCE((dt_recebimento)::timestamp without time zone, dt_troca) <= (CURRENT_DATE - 1))
414. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_carta_frete_parcelamento on carta_frete_parcelamento cfpa_3 (cost=0.29..0.46 rows=1 width=14) (never executed)

  • Index Cond: ((cd_ctrc = cfp_3.cd_ctrc) AND (id_tipo = cfp_3.id_tipo) AND (nr_parcela = cfp_3.nr_parcela))
415. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_ctrc on ctrc ct_3 (cost=0.29..0.44 rows=1 width=6) (never executed)

  • Index Cond: (cd_ctrc = cfpa_3.cd_ctrc)
416. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_ctrc_cte on ctrc_cte cte_3 (cost=0.29..0.55 rows=1 width=8) (never executed)

  • Index Cond: (cd_ctrc = ct_3.cd_ctrc)
417. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_carta_frete on carta_frete cf_3 (cost=0.29..0.37 rows=1 width=15) (never executed)

  • Index Cond: (cd_ctrc = cfpa_3.cd_ctrc)
418. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_ctrc_complemento on ctrc_complemento cc_3 (cost=0.12..0.14 rows=1 width=7) (never executed)

  • Index Cond: (cd_ctrc = ct_3.cd_ctrc)
419.          

CTE with_ctrc_a_vencer_maior

420. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=0.02..0.03 rows=1 width=4) (never executed)

  • Group Key: with_valores_ctrc_a_vencer_maior.cd_ctrc
421. 0.000 0.000 ↓ 0.0 0

CTE Scan on with_valores_ctrc_a_vencer_maior (cost=0.00..0.02 rows=1 width=4) (never executed)

422.          

CTE with_caixa_a_vencer_maior

423. 0.026 0.096 ↓ 23.0 23 1

Nested Loop (cost=0.29..8.34 rows=1 width=14) (actual time=0.011..0.096 rows=23 loops=1)

424. 0.004 0.004 ↓ 22.0 22 1

CTE Scan on with_movimento_a_vencer_maior wm_25 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.004 rows=22 loops=1)

425. 0.066 0.066 ↑ 1.0 1 22

Index Scan using idx_caixa_cd_movimento on caixa cx_3 (cost=0.29..8.31 rows=1 width=14) (actual time=0.003..0.003 rows=1 loops=22)

  • Index Cond: (cd_movimento = wm_25.cd_movimento)
  • Filter: ((dt_lancamento)::date <= (CURRENT_DATE - 1))
426.          

CTE with_a_vencer_maior

427. 0.446 1,183.154 ↑ 1.0 1 1

Aggregate (cost=65.64..65.65 rows=1 width=192) (actual time=1,183.154..1,183.154 rows=1 loops=1)

428. 0.190 1,182.708 ↓ 248.0 248 1

Nested Loop Left Join (cost=65.15..65.60 rows=1 width=208) (actual time=7.028..1,182.708 rows=248 loops=1)

  • Join Filter: (wm_31.cd_movimento = wtt_9.cd_movimento)
429. 0.535 1,182.270 ↓ 248.0 248 1

Nested Loop Left Join (cost=54.57..54.98 rows=1 width=180) (actual time=6.864..1,182.270 rows=248 loops=1)

  • Join Filter: (wc_15.cd_movimento = wtt_9.cd_movimento)
  • Rows Removed by Join Filter: 3,489
430. 0.161 1,180.991 ↓ 248.0 248 1

Merge Left Join (cost=54.55..54.92 rows=1 width=176) (actual time=6.846..1,180.991 rows=248 loops=1)

  • Merge Cond: (wtt_9.cd_movimento = em_3.cd_movimento)
431. 0.332 1,180.779 ↓ 248.0 248 1

Nested Loop Left Join (cost=52.33..52.65 rows=1 width=172) (actual time=6.797..1,180.779 rows=248 loops=1)

  • Join Filter: (wm_29.cd_movimento = wtt_9.cd_movimento)
  • Rows Removed by Join Filter: 334
432. 6.735 1,180.199 ↓ 248.0 248 1

Nested Loop Left Join (cost=49.47..49.76 rows=1 width=168) (actual time=6.745..1,180.199 rows=248 loops=1)

  • Join Filter: (wtt_11.cd_titulo = wtt_9.cd_titulo)
  • Rows Removed by Join Filter: 61,256
433. 4.513 1,076.496 ↓ 248.0 248 1

Nested Loop Left Join (cost=42.42..42.62 rows=1 width=140) (actual time=4.865..1,076.496 rows=248 loops=1)

  • Join Filter: (wtt_10.cd_titulo = wtt_9.cd_titulo)
  • Rows Removed by Join Filter: 33,839
434. 0.132 4.839 ↓ 248.0 248 1

Merge Left Join (cost=34.12..34.21 rows=1 width=44) (actual time=4.659..4.839 rows=248 loops=1)

  • Merge Cond: (wtt_9.cd_movimento = im_3.cd_movimento)
435. 0.101 4.474 ↓ 248.0 248 1

Sort (cost=0.03..0.04 rows=1 width=40) (actual time=4.423..4.474 rows=248 loops=1)

  • Sort Key: wtt_9.cd_movimento
  • Sort Method: quicksort Memory: 36kB
436. 4.373 4.373 ↓ 248.0 248 1

CTE Scan on with_total_titulo_a_vencer_maior wtt_9 (cost=0.00..0.02 rows=1 width=40) (actual time=4.204..4.373 rows=248 loops=1)

437. 0.000 0.233 ↓ 0.0 0 1

Unique (cost=34.09..34.11 rows=4 width=4) (actual time=0.233..0.233 rows=0 loops=1)

438. 0.003 0.233 ↓ 0.0 0 1

Sort (cost=34.09..34.10 rows=4 width=4) (actual time=0.233..0.233 rows=0 loops=1)

  • Sort Key: im_3.cd_movimento
  • Sort Method: quicksort Memory: 25kB
439. 0.000 0.230 ↓ 0.0 0 1

Nested Loop (cost=21.26..34.05 rows=4 width=4) (actual time=0.230..0.230 rows=0 loops=1)

440. 0.021 0.230 ↓ 0.0 0 1

Nested Loop (cost=21.11..31.91 rows=11 width=8) (actual time=0.230..0.230 rows=0 loops=1)

441. 0.187 0.187 ↓ 22.0 22 1

CTE Scan on with_movimento_a_vencer_maior wm_27 (cost=0.00..0.02 rows=1 width=4) (actual time=0.176..0.187 rows=22 loops=1)

442. 0.022 0.022 ↓ 0.0 0 22

Bitmap Heap Scan on investimento_movimento im_3 (cost=21.11..31.78 rows=11 width=8) (actual time=0.001..0.001 rows=0 loops=22)

  • Recheck Cond: (cd_movimento = wm_27.cd_movimento)
443. 0.000 0.000 ↓ 0.0 0 22

Bitmap Index Scan on pk_investimento_movimento (cost=0.00..21.11 rows=11 width=0) (actual time=0.000..0.000 rows=0 loops=22)

  • Index Cond: (cd_movimento = wm_27.cd_movimento)
444. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_investimento on investimento inv_3 (cost=0.15..0.19 rows=1 width=4) (never executed)

  • Index Cond: (cd_investimento = im_3.cd_investimento)
  • Filter: (dt_compra <= (CURRENT_DATE - 1))
445. 83.824 1,067.144 ↓ 137.0 137 248

Nested Loop (cost=8.30..8.40 rows=1 width=100) (actual time=0.005..4.303 rows=137 loops=248)

  • Join Filter: (wm_26.cd_movimento = wc_12.cd_movimento)
  • Rows Removed by Join Filter: 2,476
446. 175.088 368.280 ↓ 248.0 248 248

Nested Loop (cost=0.00..0.05 rows=1 width=76) (actual time=0.003..1.485 rows=248 loops=248)

  • Join Filter: (wtt_10.cd_movimento = wm_26.cd_movimento)
  • Rows Removed by Join Filter: 5,208
447. 8.680 8.680 ↓ 248.0 248 248

CTE Scan on with_total_titulo_a_vencer_maior wtt_10 (cost=0.00..0.02 rows=1 width=40) (actual time=0.000..0.035 rows=248 loops=248)

448. 184.512 184.512 ↓ 22.0 22 61,504

CTE Scan on with_movimento_a_vencer_maior wm_26 (cost=0.00..0.02 rows=1 width=36) (actual time=0.000..0.003 rows=22 loops=61,504)

449. 553.536 615.040 ↓ 11.0 11 61,504

GroupAggregate (cost=8.30..8.33 rows=1 width=36) (actual time=0.001..0.010 rows=11 loops=61,504)

  • Group Key: wc_12.cd_movimento
450. 61.332 61.504 ↓ 12.0 12 61,504

Sort (cost=8.30..8.31 rows=1 width=22) (actual time=0.000..0.001 rows=12 loops=61,504)

  • Sort Key: wc_12.cd_movimento
  • Sort Method: quicksort Memory: 25kB
451. 0.037 0.172 ↓ 20.0 20 1

Nested Loop (cost=0.14..8.29 rows=1 width=22) (actual time=0.020..0.172 rows=20 loops=1)

452. 0.112 0.112 ↓ 23.0 23 1

CTE Scan on with_caixa_a_vencer_maior wc_12 (cost=0.00..0.03 rows=1 width=26) (actual time=0.014..0.112 rows=23 loops=1)

  • Filter: ((cd_historico)::text <> '28'::text)
453. 0.023 0.023 ↑ 1.0 1 23

Index Scan using pk_historico_caixa on historico_caixa hc_3 (cost=0.14..8.18 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=23)

  • Index Cond: (cd_historico = wc_12.cd_historico)
  • Filter: ((id_tributo_federal = 0) AND (id_icms_terceiro = 0) AND (id_seguro_carga = 0) AND (id_inss_patronal = 0) AND (id_ipva = 0) AND (id_seguro_frota = 0))
  • Rows Removed by Filter: 0
454. 88.784 96.968 ↓ 248.0 248 248

GroupAggregate (cost=7.05..7.12 rows=1 width=104) (actual time=0.011..0.391 rows=248 loops=248)

  • Group Key: wtt_11.cd_titulo, wm_28.vl_movimento, wtt_11.vl_total_titulo
455. 6.380 8.184 ↓ 248.0 248 248

Sort (cost=7.05..7.05 rows=1 width=212) (actual time=0.008..0.033 rows=248 loops=248)

  • Sort Key: wtt_11.cd_titulo, wm_28.vl_movimento, wtt_11.vl_total_titulo
  • Sort Method: quicksort Memory: 44kB
456. 0.723 1.804 ↓ 248.0 248 1

Nested Loop (cost=0.03..7.04 rows=1 width=212) (actual time=0.095..1.804 rows=248 loops=1)

  • Join Filter: (wtt_11.cd_movimento = wm_28.cd_movimento)
  • Rows Removed by Join Filter: 5,208
457. 0.047 0.337 ↓ 248.0 248 1

Nested Loop Left Join (cost=0.03..7.00 rows=1 width=184) (actual time=0.091..0.337 rows=248 loops=1)

  • Join Filter: (wvc_5.cd_movimento = wtt_11.cd_movimento)
458. 0.042 0.042 ↓ 248.0 248 1

CTE Scan on with_total_titulo_a_vencer_maior wtt_11 (cost=0.00..0.02 rows=1 width=40) (actual time=0.000..0.042 rows=248 loops=1)

459. 0.000 0.248 ↓ 0.0 0 248

Nested Loop Left Join (cost=0.03..6.97 rows=1 width=148) (actual time=0.001..0.001 rows=0 loops=248)

  • Join Filter: (wc_13.cd_ctrc = wvc_5.cd_ctrc)
460. 0.248 0.248 ↓ 0.0 0 248

Nested Loop Left Join (cost=0.00..3.31 rows=1 width=120) (actual time=0.001..0.001 rows=0 loops=248)

  • Join Filter: (wc_14.cd_ctrc = wvc_5.cd_ctrc)
461. 0.000 0.000 ↓ 0.0 0 248

CTE Scan on with_valores_ctrc_a_vencer_maior wvc_5 (cost=0.00..0.02 rows=1 width=88) (actual time=0.000..0.000 rows=0 loops=248)

462. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.00..3.28 rows=1 width=36) (never executed)

  • Join Filter: (cfvp_7.cd_ctrc = wc_14.cd_ctrc)
463. 0.000 0.000 ↓ 0.0 0

CTE Scan on with_ctrc_a_vencer_maior wc_14 (cost=0.00..0.02 rows=1 width=4) (never executed)

464. 0.000 0.000 ↓ 0.0 0

Seq Scan on carta_frete_vale_pedagio cfvp_7 (cost=0.00..3.24 rows=2 width=36) (never executed)

  • Filter: (id_antecipado = '1'::smallint)
465. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=0.03..3.64 rows=1 width=36) (never executed)

  • Hash Cond: (cfvp_6.cd_ctrc = wc_13.cd_ctrc)
466. 0.000 0.000 ↓ 0.0 0

Seq Scan on carta_frete_vale_pedagio cfvp_6 (cost=0.00..3.24 rows=97 width=36) (never executed)

  • Filter: (id_antecipado = '0'::smallint)
467. 0.000 0.000 ↓ 0.0 0

Hash (cost=0.02..0.02 rows=1 width=4) (never executed)

468. 0.000 0.000 ↓ 0.0 0

CTE Scan on with_ctrc_a_vencer_maior wc_13 (cost=0.00..0.02 rows=1 width=4) (never executed)

469. 0.744 0.744 ↓ 22.0 22 248

CTE Scan on with_movimento_a_vencer_maior wm_28 (cost=0.00..0.02 rows=1 width=36) (actual time=0.000..0.003 rows=22 loops=248)

470. 0.000 0.248 ↓ 2.0 2 248

Unique (cost=2.86..2.86 rows=1 width=4) (actual time=0.001..0.001 rows=2 loops=248)

471. 0.204 0.248 ↓ 2.0 2 248

Sort (cost=2.86..2.86 rows=1 width=4) (actual time=0.000..0.001 rows=2 loops=248)

  • Sort Key: wm_29.cd_movimento
  • Sort Method: quicksort Memory: 25kB
472. 0.006 0.044 ↓ 2.0 2 1

Nested Loop (cost=1.09..2.85 rows=1 width=4) (actual time=0.033..0.044 rows=2 loops=1)

  • Join Filter: (vpm_3.cd_movimento = wm_29.cd_movimento)
  • Rows Removed by Join Filter: 42
473. 0.006 0.032 ↓ 2.0 2 1

Hash Join (cost=1.09..2.82 rows=1 width=4) (actual time=0.030..0.032 rows=2 loops=1)

  • Hash Cond: (vp_3.cd_veiculo = vpm_3.cd_veiculo)
474. 0.019 0.019 ↓ 1.2 13 1

Seq Scan on veiculo_proprio vp_3 (cost=0.00..1.66 rows=11 width=4) (actual time=0.011..0.019 rows=13 loops=1)

  • Filter: (COALESCE(dt_aquisicao, CURRENT_DATE) <= (CURRENT_DATE - 1))
  • Rows Removed by Filter: 20
475. 0.003 0.007 ↑ 1.0 4 1

Hash (cost=1.04..1.04 rows=4 width=8) (actual time=0.006..0.007 rows=4 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
476. 0.004 0.004 ↑ 1.0 4 1

Seq Scan on veiculo_proprio_movimento vpm_3 (cost=0.00..1.04 rows=4 width=8) (actual time=0.003..0.004 rows=4 loops=1)

477. 0.006 0.006 ↓ 22.0 22 2

CTE Scan on with_movimento_a_vencer_maior wm_29 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.003 rows=22 loops=2)

478. 0.003 0.051 ↑ 1.0 2 1

Unique (cost=2.23..2.23 rows=2 width=4) (actual time=0.047..0.051 rows=2 loops=1)

479. 0.003 0.048 ↓ 1.5 3 1

Sort (cost=2.23..2.23 rows=2 width=4) (actual time=0.047..0.048 rows=3 loops=1)

  • Sort Key: em_3.cd_movimento
  • Sort Method: quicksort Memory: 25kB
480. 0.003 0.045 ↓ 1.5 3 1

Nested Loop (cost=0.00..2.22 rows=2 width=4) (actual time=0.014..0.045 rows=3 loops=1)

  • Join Filter: (em_3.cd_emprestimo = e_3.cd_emprestimo)
  • Rows Removed by Join Filter: 3
481. 0.011 0.036 ↓ 1.5 3 1

Nested Loop (cost=0.00..1.09 rows=2 width=8) (actual time=0.007..0.036 rows=3 loops=1)

  • Join Filter: (em_3.cd_movimento = wm_30.cd_movimento)
  • Rows Removed by Join Filter: 63
482. 0.003 0.003 ↓ 22.0 22 1

CTE Scan on with_movimento_a_vencer_maior wm_30 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.003 rows=22 loops=1)

483. 0.022 0.022 ↑ 1.0 3 22

Seq Scan on emprestimo_movimento em_3 (cost=0.00..1.03 rows=3 width=8) (actual time=0.000..0.001 rows=3 loops=22)

484. 0.003 0.006 ↑ 1.5 2 3

Materialize (cost=0.00..1.07 rows=3 width=4) (actual time=0.001..0.002 rows=2 loops=3)

485. 0.003 0.003 ↑ 1.0 3 1

Seq Scan on emprestimo e_3 (cost=0.00..1.05 rows=3 width=4) (actual time=0.003..0.003 rows=3 loops=1)

  • Filter: (dt_contrato <= (CURRENT_DATE - 1))
486. 0.741 0.744 ↓ 15.0 15 248

HashAggregate (cost=0.02..0.03 rows=1 width=36) (actual time=0.001..0.003 rows=15 loops=248)

  • Group Key: wc_15.cd_movimento
487. 0.003 0.003 ↓ 23.0 23 1

CTE Scan on with_caixa_a_vencer_maior wc_15 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.003 rows=23 loops=1)

488. 0.000 0.248 ↓ 0.0 0 248

GroupAggregate (cost=10.58..10.60 rows=1 width=36) (actual time=0.001..0.001 rows=0 loops=248)

  • Group Key: wm_31.cd_movimento
489. 0.088 0.248 ↓ 0.0 0 248

Sort (cost=10.58..10.58 rows=1 width=9) (actual time=0.001..0.001 rows=0 loops=248)

  • Sort Key: wm_31.cd_movimento
  • Sort Method: quicksort Memory: 25kB
490. 0.045 0.160 ↓ 0.0 0 1

Hash Join (cost=0.03..10.57 rows=1 width=9) (actual time=0.160..0.160 rows=0 loops=1)

  • Hash Cond: (vv_3.cd_movimento = wm_31.cd_movimento)
491. 0.107 0.107 ↑ 1.0 307 1

Seq Scan on viagem_valor vv_3 (cost=0.00..9.37 rows=307 width=9) (actual time=0.004..0.107 rows=307 loops=1)

  • Filter: (dt_valor <= (CURRENT_DATE - 1))
492. 0.004 0.008 ↓ 22.0 22 1

Hash (cost=0.02..0.02 rows=1 width=4) (actual time=0.008..0.008 rows=22 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
493. 0.004 0.004 ↓ 22.0 22 1

CTE Scan on with_movimento_a_vencer_maior wm_31 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.004 rows=22 loops=1)

494. 0.011 1,263.961 ↑ 1.0 6 1

HashAggregate (cost=1.02..1.08 rows=6 width=224) (actual time=1,263.959..1,263.961 rows=6 loops=1)

  • Group Key: ('Adto/Saldo/V. Comb'::text), (round(wv1.vl_carta_frete, 2)), (round(wv2.vl_carta_frete, 2)), (round(wvp.vl_carta_frete, 2)), (round(((wv1.vl_carta_frete + wv2.vl_carta_frete) + wvp.vl_carta_frete), 2)), (round(wvm.vl_carta_frete, 2)), (round((((wv1.vl_carta_frete + wv2.vl_carta_frete) + wvp.vl_carta_frete) + wvm.vl_carta_frete), 2))
495. 0.005 1,263.950 ↑ 1.0 6 1

Append (cost=0.00..0.92 rows=6 width=224) (actual time=1,263.894..1,263.950 rows=6 loops=1)

496. 0.007 1,263.898 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.14 rows=1 width=224) (actual time=1,263.893..1,263.898 rows=1 loops=1)

497. 0.002 80.734 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.08 rows=1 width=96) (actual time=80.730..80.734 rows=1 loops=1)

498. 0.003 38.023 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.05 rows=1 width=64) (actual time=38.020..38.023 rows=1 loops=1)

499. 36.056 36.056 ↑ 1.0 1 1

CTE Scan on with_vencida wv1 (cost=0.00..0.02 rows=1 width=32) (actual time=36.055..36.056 rows=1 loops=1)

500. 1.964 1.964 ↑ 1.0 1 1

CTE Scan on with_vencendo wv2 (cost=0.00..0.02 rows=1 width=32) (actual time=1.963..1.964 rows=1 loops=1)

501. 42.709 42.709 ↑ 1.0 1 1

CTE Scan on with_a_vencer_periodo wvp (cost=0.00..0.02 rows=1 width=32) (actual time=42.708..42.709 rows=1 loops=1)

502. 1,183.157 1,183.157 ↑ 1.0 1 1

CTE Scan on with_a_vencer_maior wvm (cost=0.00..0.02 rows=1 width=32) (actual time=1,183.156..1,183.157 rows=1 loops=1)

503. 0.005 0.012 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.14 rows=1 width=224) (actual time=0.011..0.012 rows=1 loops=1)

504. 0.002 0.007 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.08 rows=1 width=96) (actual time=0.006..0.007 rows=1 loops=1)

505. 0.002 0.004 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.05 rows=1 width=64) (actual time=0.004..0.004 rows=1 loops=1)

506. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on with_vencida wv1_1 (cost=0.00..0.02 rows=1 width=32) (actual time=0.001..0.001 rows=1 loops=1)

507. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on with_vencendo wv2_1 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.001 rows=1 loops=1)

508. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on with_a_vencer_periodo wvp_1 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.001 rows=1 loops=1)

509. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_a_vencer_maior wvm_1 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

510. 0.005 0.010 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.14 rows=1 width=224) (actual time=0.008..0.010 rows=1 loops=1)

511. 0.002 0.005 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.08 rows=1 width=96) (actual time=0.004..0.005 rows=1 loops=1)

512. 0.001 0.002 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.05 rows=1 width=64) (actual time=0.002..0.002 rows=1 loops=1)

513. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on with_vencida wv1_2 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.001 rows=1 loops=1)

514. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_vencendo wv2_2 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

515. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on with_a_vencer_periodo wvp_2 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.001 rows=1 loops=1)

516. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_a_vencer_maior wvm_2 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

517. 0.005 0.009 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.14 rows=1 width=224) (actual time=0.007..0.009 rows=1 loops=1)

518. 0.002 0.004 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.08 rows=1 width=96) (actual time=0.004..0.004 rows=1 loops=1)

519. 0.001 0.002 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.05 rows=1 width=64) (actual time=0.002..0.002 rows=1 loops=1)

520. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on with_vencida wv1_3 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.001 rows=1 loops=1)

521. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_vencendo wv2_3 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

522. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_a_vencer_periodo wvp_3 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

523. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_a_vencer_maior wvm_3 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

524. 0.004 0.008 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.14 rows=1 width=224) (actual time=0.007..0.008 rows=1 loops=1)

525. 0.002 0.004 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.08 rows=1 width=96) (actual time=0.003..0.004 rows=1 loops=1)

526. 0.002 0.002 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.05 rows=1 width=64) (actual time=0.002..0.002 rows=1 loops=1)

527. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_vencida wv1_4 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

528. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_vencendo wv2_4 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

529. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_a_vencer_periodo wvp_4 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

530. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_a_vencer_maior wvm_4 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

531. 0.004 0.008 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.14 rows=1 width=224) (actual time=0.007..0.008 rows=1 loops=1)

532. 0.002 0.004 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.08 rows=1 width=96) (actual time=0.003..0.004 rows=1 loops=1)

533. 0.001 0.002 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.05 rows=1 width=64) (actual time=0.002..0.002 rows=1 loops=1)

534. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on with_vencida wv1_5 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.001 rows=1 loops=1)

535. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_vencendo wv2_5 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

536. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_a_vencer_periodo wvp_5 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

537. 0.000 0.000 ↑ 1.0 1 1

CTE Scan on with_a_vencer_maior wvm_5 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.000 rows=1 loops=1)

Planning time : 40.760 ms
Execution time : 1,266.416 ms