explain.depesz.com

PostgreSQL's explain analyze made readable

Result: XtND

Settings
# exclusive inclusive rows x rows loops node
1. 0.022 29,274.032 ↑ 155.0 1 1

Sort (cost=1,321,705.19..1,321,705.57 rows=155 width=958) (actual time=29,274.032..29,274.032 rows=1 loops=1)

  • Sort Key: wm.cd_movimento, wm.nr_parcela, wm.cd_titulo
  • Sort Method: quicksort Memory: 37kB
2.          

CTE with_movimento

3. 0.040 2.271 ↑ 1.0 1 1

Nested Loop Left Join (cost=1,643.58..1,663.23 rows=1 width=883) (actual time=2.262..2.271 rows=1 loops=1)

4. 0.002 2.228 ↑ 1.0 1 1

Nested Loop Left Join (cost=1,643.43..1,660.75 rows=1 width=462) (actual time=2.220..2.228 rows=1 loops=1)

5. 0.004 2.216 ↑ 1.0 1 1

Nested Loop Left Join (cost=1,643.30..1,660.59 rows=1 width=446) (actual time=2.207..2.216 rows=1 loops=1)

6. 0.003 2.210 ↑ 1.0 1 1

Nested Loop Left Join (cost=1,643.15..1,660.43 rows=1 width=426) (actual time=2.202..2.210 rows=1 loops=1)

7. 0.003 2.205 ↑ 1.0 1 1

Nested Loop Left Join (cost=1,643.01..1,660.27 rows=1 width=427) (actual time=2.197..2.205 rows=1 loops=1)

8. 0.004 2.196 ↑ 1.0 1 1

Nested Loop Left Join (cost=1,642.72..1,657.77 rows=1 width=415) (actual time=2.188..2.196 rows=1 loops=1)

9. 0.031 2.182 ↑ 1.0 1 1

Nested Loop (cost=1,642.30..1,655.13 rows=1 width=390) (actual time=2.174..2.182 rows=1 loops=1)

10. 0.002 2.137 ↑ 1.0 1 1

Nested Loop (cost=1,639.24..1,649.84 rows=1 width=359) (actual time=2.129..2.137 rows=1 loops=1)

11. 0.003 2.123 ↑ 1.0 1 1

Nested Loop (cost=1,638.81..1,647.19 rows=1 width=330) (actual time=2.116..2.123 rows=1 loops=1)

12. 0.015 2.084 ↑ 1.0 1 1

Hash Join (cost=1,637.96..1,638.73 rows=1 width=82) (actual time=2.078..2.084 rows=1 loops=1)

  • Hash Cond: ((pj.cd_pessoa = m.cd_pessoa_filial) AND ((COALESCE((SubPlan 2), f.cd_pessoa_matriz)) = m.cd_pessoa_matriz))
13. 0.007 2.044 ↓ 1.1 25 1

Unique (cost=1,635.30..1,635.74 rows=22 width=101) (actual time=2.036..2.044 rows=25 loops=1)

14. 0.037 2.037 ↓ 1.1 25 1

Sort (cost=1,635.30..1,635.35 rows=22 width=101) (actual time=2.036..2.037 rows=25 loops=1)

  • Sort Key: p_2.nm_fantasia, pj.cd_pessoa, p_2.cd_cidade, (((ci_1.nm_cidade || ' / '::text) || (uf_1.ds_sigla)::text)), pj.nr_cnpj, (substr((pj.nr_cnpj)::text, 1, 8)), (COALESCE((SubPlan 2), f.cd_pessoa_matriz))
  • Sort Method: quicksort Memory: 28kB
15. 0.041 2.000 ↓ 1.1 25 1

Nested Loop (cost=2.42..1,634.81 rows=22 width=101) (actual time=0.276..2.000 rows=25 loops=1)

16. 0.015 0.384 ↓ 1.1 25 1

Nested Loop (cost=2.27..74.55 rows=22 width=53) (actual time=0.072..0.384 rows=25 loops=1)

17. 0.005 0.294 ↓ 1.1 25 1

Nested Loop (cost=1.99..67.95 rows=22 width=37) (actual time=0.059..0.294 rows=25 loops=1)

  • Join Filter: (f.cd_pessoa_filial = pj.cd_pessoa)
18. 0.025 0.239 ↓ 1.1 25 1

Nested Loop (cost=1.70..60.79 rows=22 width=26) (actual time=0.046..0.239 rows=25 loops=1)

19. 0.014 0.039 ↓ 1.1 25 1

Hash Join (cost=1.27..2.71 rows=22 width=8) (actual time=0.028..0.039 rows=25 loops=1)

  • Hash Cond: (f.cd_pessoa_matriz = eg.cd_pessoa)
20. 0.014 0.014 ↑ 1.0 27 1

Seq Scan on filial f (cost=0.00..1.34 rows=27 width=8) (actual time=0.010..0.014 rows=27 loops=1)

  • Filter: (id_ativo = 1)
21. 0.003 0.011 ↑ 1.0 10 1

Hash (cost=1.15..1.15 rows=10 width=4) (actual time=0.011..0.011 rows=10 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
22. 0.008 0.008 ↑ 1.0 10 1

Seq Scan on empresa_grupo eg (cost=0.00..1.15 rows=10 width=4) (actual time=0.006..0.008 rows=10 loops=1)

  • Filter: (id_ativo = 1)
  • Rows Removed by Filter: 2
23. 0.175 0.175 ↑ 1.0 1 25

Index Scan using pk_pessoa on pessoa p_2 (cost=0.42..2.64 rows=1 width=18) (actual time=0.007..0.007 rows=1 loops=25)

  • Index Cond: (cd_pessoa = f.cd_pessoa_filial)
24. 0.050 0.050 ↑ 1.0 1 25

Index Scan using pk_pessoa_juridica on pessoa_juridica pj (cost=0.29..0.31 rows=1 width=19) (actual time=0.002..0.002 rows=1 loops=25)

  • Index Cond: (cd_pessoa = p_2.cd_pessoa)
25. 0.075 0.075 ↑ 1.0 1 25

Index Scan using pk_cidade on cidade ci_1 (cost=0.28..0.30 rows=1 width=20) (actual time=0.003..0.003 rows=1 loops=25)

  • Index Cond: (cd_cidade = p_2.cd_cidade)
26. 0.025 0.025 ↑ 1.0 1 25

Index Scan using pk_uf on uf uf_1 (cost=0.14..0.16 rows=1 width=7) (actual time=0.001..0.001 rows=1 loops=25)

  • Index Cond: (cd_uf = ci_1.cd_uf)
27.          

SubPlan (forNested Loop)

28. 0.025 1.550 ↑ 1.0 1 25

Limit (cost=70.74..70.75 rows=1 width=4) (actual time=0.061..0.062 rows=1 loops=25)

29. 0.000 1.525 ↑ 1.0 1 25

Unique (cost=70.74..70.75 rows=1 width=4) (actual time=0.061..0.061 rows=1 loops=25)

30. 0.050 1.525 ↑ 1.0 1 25

Sort (cost=70.74..70.74 rows=1 width=4) (actual time=0.061..0.061 rows=1 loops=25)

  • Sort Key: p_1.cd_pessoa
  • Sort Method: quicksort Memory: 25kB
31. 0.025 1.475 ↑ 1.0 1 25

Nested Loop (cost=0.71..70.73 rows=1 width=4) (actual time=0.020..0.059 rows=1 loops=25)

  • Join Filter: (f_1.cd_pessoa_filial = p_1.cd_pessoa)
32. 0.000 1.400 ↑ 1.0 1 25

Nested Loop (cost=0.29..68.35 rows=1 width=8) (actual time=0.017..0.056 rows=1 loops=25)

33. 0.075 0.075 ↑ 1.0 27 25

Seq Scan on filial f_1 (cost=0.00..1.27 rows=27 width=4) (actual time=0.001..0.003 rows=27 loops=25)

34. 1.350 1.350 ↓ 0.0 0 675

Index Scan using pk_pessoa_juridica on pessoa_juridica pjm (cost=0.29..2.48 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=675)

  • Index Cond: (cd_pessoa = f_1.cd_pessoa_filial)
  • Filter: (substr((nr_cnpj)::text, 1, 12) = (substr((pj.nr_cnpj)::text, 1, 8) || '0001'::text))
  • Rows Removed by Filter: 1
35. 0.050 0.050 ↑ 1.0 1 25

Index Only Scan using pk_pessoa on pessoa p_1 (cost=0.42..2.36 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=25)

  • Index Cond: (cd_pessoa = pjm.cd_pessoa)
  • Heap Fetches: 25
36. 0.002 0.025 ↑ 1.0 1 1

Hash (cost=2.65..2.65 rows=1 width=36) (actual time=0.025..0.025 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
37. 0.023 0.023 ↑ 1.0 1 1

Index Scan using pk_movimento on movimento m (cost=0.43..2.65 rows=1 width=36) (actual time=0.022..0.023 rows=1 loops=1)

  • Index Cond: (cd_movimento = 1791443)
  • Filter: (cd_pessoa = 786)
38. 0.003 0.036 ↑ 1.0 1 1

Nested Loop (cost=0.85..8.45 rows=1 width=252) (actual time=0.035..0.036 rows=1 loops=1)

39. 0.017 0.017 ↑ 2.0 1 1

Index Scan using idx_titulo_cd_movimento on titulo t (cost=0.43..3.16 rows=2 width=155) (actual time=0.016..0.017 rows=1 loops=1)

  • Index Cond: (cd_movimento = 1791443)
  • Filter: (id_tipo = 2)
40. 0.016 0.016 ↑ 1.0 1 1

Index Scan using pk_titulo_debito on titulo_debito td (cost=0.43..2.65 rows=1 width=105) (actual time=0.016..0.016 rows=1 loops=1)

  • Index Cond: (cd_titulo = t.cd_titulo)
41. 0.012 0.012 ↑ 1.0 1 1

Index Scan using pk_pessoa on pessoa p (cost=0.42..2.64 rows=1 width=33) (actual time=0.011..0.012 rows=1 loops=1)

  • Index Cond: (cd_pessoa = 786)
42. 0.000 0.014 ↑ 1.0 1 1

Index Scan using pk_endereco on endereco e (cost=3.07..5.28 rows=1 width=41) (actual time=0.014..0.014 rows=1 loops=1)

  • Index Cond: (cd_endereco = (SubPlan 1))
43.          

SubPlan (forIndex Scan)

44. 0.001 0.026 ↑ 1.0 1 1

Limit (cost=0.42..2.64 rows=1 width=6) (actual time=0.026..0.026 rows=1 loops=1)

45. 0.025 0.025 ↑ 1.0 1 1

Index Scan using idx_endereco_cd_pessoa on endereco (cost=0.42..2.64 rows=1 width=6) (actual time=0.025..0.025 rows=1 loops=1)

  • Index Cond: (cd_pessoa = pj.cd_pessoa)
  • Filter: (id_tipo_endereco = ANY ('{2,3,4}'::integer[]))
46. 0.010 0.010 ↑ 1.0 1 1

Index Scan using pk_pessoa on pessoa pu (cost=0.42..2.64 rows=1 width=29) (actual time=0.010..0.010 rows=1 loops=1)

  • Index Cond: (m.cd_pessoa_usuario = cd_pessoa)
47. 0.006 0.006 ↑ 1.0 1 1

Index Scan using pk_cidade on cidade ci (cost=0.28..2.50 rows=1 width=20) (actual time=0.005..0.006 rows=1 loops=1)

  • Index Cond: (cd_cidade = p.cd_cidade)
48. 0.002 0.002 ↑ 1.0 1 1

Index Scan using pk_uf on uf (cost=0.14..0.16 rows=1 width=7) (actual time=0.002..0.002 rows=1 loops=1)

  • Index Cond: (cd_uf = ci.cd_uf)
49. 0.002 0.002 ↓ 0.0 0 1

Index Scan using pk_tipo_pagamento on tipo_pagamento tp (cost=0.15..0.17 rows=1 width=28) (actual time=0.002..0.002 rows=0 loops=1)

  • Index Cond: (cd_tipo_pagamento = td.cd_tipo_pagamento)
50. 0.010 0.010 ↑ 1.0 1 1

Index Scan using pk_tipo_documento_cobranca on tipo_documento_cobranca tdc (cost=0.14..0.15 rows=1 width=24) (actual time=0.010..0.010 rows=1 loops=1)

  • Index Cond: (cd_tipo_documento = td.cd_tipo_documento)
51. 0.003 0.003 ↓ 0.0 0 1

Index Scan using pk_portador on portador po (cost=0.15..2.37 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: (cd_portador = t.cd_portador)
52.          

CTE with_conta

53. 52.982 103.226 ↓ 1.1 32,766 1

GroupAggregate (cost=3,452.66..5,787.00 rows=30,941 width=36) (actual time=41.239..103.226 rows=32,766 loops=1)

  • Group Key: c.cd_pessoa
54. 26.425 50.244 ↑ 1.0 33,813 1

Sort (cost=3,452.66..3,537.34 rows=33,871 width=57) (actual time=41.210..50.244 rows=33,813 loops=1)

  • Sort Key: c.cd_pessoa
  • Sort Method: quicksort Memory: 5079kB
55. 12.874 23.819 ↑ 1.0 33,813 1

Hash Join (cost=1.65..904.25 rows=33,871 width=57) (actual time=0.061..23.819 rows=33,813 loops=1)

  • Hash Cond: (c.cd_banco = b.cd_banco)
56. 10.916 10.916 ↑ 1.0 33,813 1

Seq Scan on conta c (cost=0.00..800.69 rows=33,871 width=43) (actual time=0.019..10.916 rows=33,813 loops=1)

  • Filter: (id_principal = 1)
  • Rows Removed by Filter: 2300
57. 0.010 0.029 ↑ 1.0 29 1

Hash (cost=1.29..1.29 rows=29 width=22) (actual time=0.029..0.029 rows=29 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
58. 0.019 0.019 ↑ 1.0 29 1

Seq Scan on banco b (cost=0.00..1.29 rows=29 width=22) (actual time=0.011..0.019 rows=29 loops=1)

59.          

CTE with_anexo_imagem

60. 1,623.761 27,556.628 ↓ 1.0 2,499,484 1

Finalize GroupAggregate (cost=481,153.98..1,227,388.88 rows=2,403,584 width=14) (actual time=23,251.645..27,556.628 rows=2,499,484 loops=1)

  • Group Key: cc.cd_ctrc
61. 0.000 25,932.867 ↑ 1.8 2,499,488 1

Gather Merge (cost=481,153.98..1,059,158.91 rows=4,587,900 width=16) (actual time=23,251.624..25,932.867 rows=2,499,488 loops=1)

  • Workers Planned: 4
  • Workers Launched: 4
62. 2,670.465 120,389.935 ↑ 2.3 499,898 5

Partial GroupAggregate (cost=480,153.92..511,695.73 rows=1,146,975 width=16) (actual time=23,129.797..24,077.987 rows=499,898 loops=5)

  • Group Key: cc.cd_ctrc
63. 10,077.480 117,719.470 ↑ 1.1 1,080,270 5

Sort (cost=480,153.92..483,021.36 rows=1,146,975 width=228) (actual time=23,129.780..23,543.894 rows=1,080,270 loops=5)

  • Sort Key: cc.cd_ctrc
  • Sort Method: external merge Disk: 125136kB
64. 2,910.320 107,641.990 ↑ 1.1 1,080,270 5

Hash Left Join (cost=2.34..291,236.16 rows=1,146,975 width=228) (actual time=27.006..21,528.398 rows=1,080,270 loops=5)

  • Hash Cond: (cc.cd_comprovante = ce.cd_comprovante)
65. 6,652.770 104,731.385 ↑ 1.1 1,080,270 5

Merge Left Join (cost=1.29..281,844.26 rows=1,146,975 width=228) (actual time=26.869..20,946.277 rows=1,080,270 loops=5)

  • Merge Cond: (cq.cd_ctrc = cc.cd_ctrc)
66. 3,899.920 48,263.850 ↑ 1.1 605,538 5

Merge Left Join (cost=0.86..145,816.80 rows=652,698 width=222) (actual time=0.222..9,652.770 rows=605,538 loops=5)

  • Merge Cond: (cq.cd_ctrc = ci_2.cd_ctrc)
67. 3,162.850 3,162.850 ↑ 1.3 522,136 5

Parallel Index Only Scan using pk_ctrc_quebra on ctrc_quebra cq (cost=0.43..44,194.37 rows=652,698 width=4) (actual time=0.130..632.570 rows=522,136 loops=5)

  • Heap Fetches: 562910
68. 41,201.080 41,201.080 ↓ 1.3 2,431,817 5

Index Scan using idx_ctrc_imagem_cd_ctrc on ctrc_imagem ci_2 (cost=0.43..90,815.83 rows=1,834,970 width=222) (actual time=0.090..8,240.216 rows=2,431,817 loops=5)

  • Filter: ((id_validacao IS NULL) OR (id_validacao <> 0))
  • Rows Removed by Filter: 1918
69. 49,814.765 49,814.765 ↓ 1.0 4,708,770 5

Index Scan using pk_ctrc_comprovante on ctrc_comprovante cc (cost=0.43..111,456.21 rows=4,587,900 width=10) (actual time=0.052..9,962.953 rows=4,708,770 loops=5)

70. 0.035 0.285 ↑ 1.0 2 5

Hash (cost=1.02..1.02 rows=2 width=8) (actual time=0.056..0.057 rows=2 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
71. 0.250 0.250 ↑ 1.0 2 5

Seq Scan on comprovante_entrega ce (cost=0.00..1.02 rows=2 width=8) (actual time=0.049..0.050 rows=2 loops=5)

72.          

CTE with_tmp_carta_frete_pagamento

73. 375.356 29,081.803 ↑ 2.1 20 1

Hash Right Join (cost=1,875.12..73,987.90 rows=43 width=438) (actual time=29,028.727..29,081.803 rows=20 loops=1)

  • Hash Cond: (wai.cd_ctrc = c_1.cd_ctrc)
74. 28,698.096 28,698.096 ↓ 1.0 2,499,484 1

CTE Scan on with_anexo_imagem wai (cost=0.00..48,071.68 rows=2,403,584 width=14) (actual time=23,251.649..28,698.096 rows=2,499,484 loops=1)

75. 0.028 8.351 ↑ 2.0 20 1

Hash (cost=1,874.62..1,874.62 rows=40 width=177) (actual time=8.351..8.351 rows=20 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
76. 0.027 8.323 ↑ 2.0 20 1

Nested Loop Left Join (cost=1,709.20..1,874.62 rows=40 width=177) (actual time=2.281..8.323 rows=20 loops=1)

77. 0.019 8.196 ↑ 2.0 20 1

Nested Loop Left Join (cost=1,708.78..1,856.73 rows=40 width=172) (actual time=2.267..8.196 rows=20 loops=1)

78. 0.031 8.137 ↑ 2.0 20 1

Nested Loop (cost=1,708.49..1,844.53 rows=40 width=170) (actual time=2.256..8.137 rows=20 loops=1)

79. 0.023 5.946 ↑ 2.0 20 1

Nested Loop Left Join (cost=1,708.07..1,826.82 rows=40 width=149) (actual time=2.244..5.946 rows=20 loops=1)

80. 0.017 5.863 ↑ 2.0 20 1

Nested Loop Left Join (cost=1,707.65..1,809.16 rows=40 width=128) (actual time=2.233..5.863 rows=20 loops=1)

81. 0.022 4.266 ↑ 2.0 20 1

Hash Join (cost=1,707.22..1,791.36 rows=40 width=125) (actual time=2.212..4.266 rows=20 loops=1)

  • Hash Cond: (ct.cd_pessoa_filial = vw.cd_pessoa)
82. 0.049 2.129 ↑ 2.0 20 1

Nested Loop (cost=2.15..85.73 rows=40 width=119) (actual time=0.089..2.129 rows=20 loops=1)

  • Join Filter: (cf.cd_ctrc = ct.cd_ctrc)
83. 0.036 1.940 ↑ 2.0 20 1

Nested Loop (cost=1.72..65.89 rows=40 width=95) (actual time=0.068..1.940 rows=20 loops=1)

84. 0.027 1.804 ↑ 2.0 20 1

Nested Loop (cost=1.29..48.22 rows=40 width=99) (actual time=0.056..1.804 rows=20 loops=1)

85. 0.041 1.637 ↑ 2.3 20 1

Nested Loop (cost=0.86..26.31 rows=46 width=44) (actual time=0.037..1.637 rows=20 loops=1)

86. 0.011 1.436 ↑ 2.4 20 1

Nested Loop (cost=0.43..4.26 rows=47 width=32) (actual time=0.017..1.436 rows=20 loops=1)

87. 0.002 0.002 ↑ 1.0 1 1

CTE Scan on with_movimento wm_1 (cost=0.00..0.02 rows=1 width=12) (actual time=0.000..0.002 rows=1 loops=1)

88. 1.423 1.423 ↑ 2.4 20 1

Index Scan using idx_carta_frete_pagamento_cd_movimento on carta_frete_pagamento c_1 (cost=0.43..3.77 rows=47 width=24) (actual time=0.013..1.423 rows=20 loops=1)

  • Index Cond: (cd_movimento = wm_1.cd_movimento)
89. 0.160 0.160 ↑ 1.0 1 20

Index Scan using pk_carta_frete_parcelamento on carta_frete_parcelamento cfpa (cost=0.43..0.47 rows=1 width=14) (actual time=0.008..0.008 rows=1 loops=20)

  • Index Cond: ((cd_ctrc = c_1.cd_ctrc) AND (id_tipo = c_1.id_tipo) AND (nr_parcela = c_1.nr_parcela))
90. 0.140 0.140 ↑ 1.0 1 20

Index Scan using pk_carta_frete on carta_frete cf (cost=0.43..0.48 rows=1 width=55) (actual time=0.007..0.007 rows=1 loops=20)

  • Index Cond: (cd_ctrc = c_1.cd_ctrc)
91. 0.100 0.100 ↑ 1.0 1 20

Index Only Scan using pk_pessoa on pessoa pa (cost=0.42..0.44 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=20)

  • Index Cond: (cd_pessoa = c_1.cd_pessoa)
  • Heap Fetches: 20
92. 0.140 0.140 ↑ 1.0 1 20

Index Scan using pk_ctrc on ctrc ct (cost=0.43..0.48 rows=1 width=32) (actual time=0.007..0.007 rows=1 loops=20)

  • Index Cond: (cd_ctrc = cfpa.cd_ctrc)
93. 0.009 2.115 ↓ 1.1 25 1

Hash (cost=1,704.80..1,704.80 rows=22 width=14) (actual time=2.115..2.115 rows=25 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
94. 0.005 2.106 ↓ 1.1 25 1

Subquery Scan on vw (cost=1,704.14..1,704.80 rows=22 width=14) (actual time=2.094..2.106 rows=25 loops=1)

95. 0.008 2.101 ↓ 1.1 25 1

Unique (cost=1,704.14..1,704.58 rows=22 width=101) (actual time=2.092..2.101 rows=25 loops=1)

96. 0.035 2.093 ↓ 1.1 25 1

Sort (cost=1,704.14..1,704.20 rows=22 width=101) (actual time=2.091..2.093 rows=25 loops=1)

  • Sort Key: p_3.nm_fantasia, p_3.cd_pessoa, p_3.cd_cidade, (((ci_3.nm_cidade || ' / '::text) || (uf_2.ds_sigla)::text)), pj_1.nr_cnpj, (substr((pj_1.nr_cnpj)::text, 1, 8)), (COALESCE((SubPlan 6), f_2.cd_pessoa_matriz))
  • Sort Method: quicksort Memory: 28kB
97. 0.030 2.058 ↓ 1.1 25 1

Nested Loop (cost=2.42..1,703.65 rows=22 width=101) (actual time=0.181..2.058 rows=25 loops=1)

98. 0.025 0.353 ↓ 1.1 25 1

Nested Loop (cost=2.27..143.40 rows=22 width=53) (actual time=0.088..0.353 rows=25 loops=1)

99. 0.006 0.278 ↓ 1.1 25 1

Nested Loop (cost=1.99..136.79 rows=22 width=37) (actual time=0.083..0.278 rows=25 loops=1)

100. 0.012 0.147 ↓ 1.1 25 1

Nested Loop Left Join (cost=1.57..78.71 rows=22 width=23) (actual time=0.076..0.147 rows=25 loops=1)

  • Join Filter: (pg.cd_empresa = f_2.cd_pessoa_matriz)
  • Rows Removed by Join Filter: 18
101. 0.026 0.085 ↓ 1.1 25 1

Nested Loop Left Join (cost=1.57..57.03 rows=22 width=23) (actual time=0.027..0.085 rows=25 loops=1)

102. 0.017 0.034 ↓ 1.1 25 1

Hash Join (cost=1.27..2.71 rows=22 width=8) (actual time=0.021..0.034 rows=25 loops=1)

  • Hash Cond: (f_2.cd_pessoa_matriz = eg_1.cd_pessoa)
103. 0.008 0.008 ↑ 1.0 27 1

Seq Scan on filial f_2 (cost=0.00..1.34 rows=27 width=8) (actual time=0.004..0.008 rows=27 loops=1)

  • Filter: (id_ativo = 1)
104. 0.003 0.009 ↑ 1.0 10 1

Hash (cost=1.15..1.15 rows=10 width=4) (actual time=0.009..0.009 rows=10 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
105. 0.006 0.006 ↑ 1.0 10 1

Seq Scan on empresa_grupo eg_1 (cost=0.00..1.15 rows=10 width=4) (actual time=0.004..0.006 rows=10 loops=1)

  • Filter: (id_ativo = 1)
  • Rows Removed by Filter: 2
106. 0.025 0.025 ↑ 1.0 1 25

Index Scan using pk_pessoa_juridica on pessoa_juridica pj_1 (cost=0.29..2.47 rows=1 width=19) (actual time=0.001..0.001 rows=1 loops=25)

  • Index Cond: (cd_pessoa = f_2.cd_pessoa_filial)
107. 0.005 0.050 ↑ 2.0 1 25

Materialize (cost=0.00..21.03 rows=2 width=4) (actual time=0.002..0.002 rows=1 loops=25)

108. 0.045 0.045 ↑ 2.0 1 1

Seq Scan on parametro_geral pg (cost=0.00..21.02 rows=2 width=4) (actual time=0.045..0.045 rows=1 loops=1)

109. 0.125 0.125 ↑ 1.0 1 25

Index Scan using pk_pessoa on pessoa p_3 (cost=0.42..2.64 rows=1 width=18) (actual time=0.005..0.005 rows=1 loops=25)

  • Index Cond: (cd_pessoa = f_2.cd_pessoa_filial)
110. 0.050 0.050 ↑ 1.0 1 25

Index Scan using pk_cidade on cidade ci_3 (cost=0.28..0.30 rows=1 width=20) (actual time=0.002..0.002 rows=1 loops=25)

  • Index Cond: (cd_cidade = p_3.cd_cidade)
111. 0.025 0.025 ↑ 1.0 1 25

Index Scan using pk_uf on uf uf_2 (cost=0.14..0.16 rows=1 width=7) (actual time=0.001..0.001 rows=1 loops=25)

  • Index Cond: (cd_uf = ci_3.cd_uf)
112.          

SubPlan (forNested Loop)

113. 0.025 1.650 ↑ 1.0 1 25

Limit (cost=70.74..70.75 rows=1 width=4) (actual time=0.065..0.066 rows=1 loops=25)

114. 0.025 1.625 ↑ 1.0 1 25

Unique (cost=70.74..70.75 rows=1 width=4) (actual time=0.065..0.065 rows=1 loops=25)

115. 0.025 1.600 ↑ 1.0 1 25

Sort (cost=70.74..70.74 rows=1 width=4) (actual time=0.064..0.064 rows=1 loops=25)

  • Sort Key: p_1_1.cd_pessoa
  • Sort Method: quicksort Memory: 25kB
116. 0.050 1.575 ↑ 1.0 1 25

Nested Loop (cost=0.71..70.73 rows=1 width=4) (actual time=0.023..0.063 rows=1 loops=25)

  • Join Filter: (f_1_1.cd_pessoa_filial = p_1_1.cd_pessoa)
117. 0.050 1.475 ↑ 1.0 1 25

Nested Loop (cost=0.29..68.35 rows=1 width=8) (actual time=0.019..0.059 rows=1 loops=25)

118. 0.075 0.075 ↑ 1.0 27 25

Seq Scan on filial f_1_1 (cost=0.00..1.27 rows=27 width=4) (actual time=0.001..0.003 rows=27 loops=25)

119. 1.350 1.350 ↓ 0.0 0 675

Index Scan using pk_pessoa_juridica on pessoa_juridica pjm_1 (cost=0.29..2.48 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=675)

  • Index Cond: (cd_pessoa = f_1_1.cd_pessoa_filial)
  • Filter: (substr((nr_cnpj)::text, 1, 12) = (substr((pj_1.nr_cnpj)::text, 1, 8) || '0001'::text))
  • Rows Removed by Filter: 1
120. 0.050 0.050 ↑ 1.0 1 25

Index Only Scan using pk_pessoa on pessoa p_1_1 (cost=0.42..2.36 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=25)

  • Index Cond: (cd_pessoa = pjm_1.cd_pessoa)
  • Heap Fetches: 25
121. 1.580 1.580 ↑ 1.0 1 20

Index Scan using pk_veiculo on veiculo v (cost=0.42..0.44 rows=1 width=11) (actual time=0.079..0.079 rows=1 loops=20)

  • Index Cond: (ct.cd_veiculo = cd_veiculo)
122. 0.060 0.060 ↑ 1.0 1 20

Index Scan using pk_pessoa on pessoa ua (cost=0.42..0.44 rows=1 width=29) (actual time=0.003..0.003 rows=1 loops=20)

  • Index Cond: (cd_pessoa = c_1.cd_usuario)
123. 2.160 2.160 ↑ 1.0 1 20

Index Scan using pk_pessoa on pessoa ue (cost=0.42..0.44 rows=1 width=29) (actual time=0.108..0.108 rows=1 loops=20)

  • Index Cond: (cd_pessoa = ct.cd_pessoa_usuario)
124. 0.040 0.040 ↓ 0.0 0 20

Index Scan using pk_ctrc_complemento on ctrc_complemento cc_1 (cost=0.29..0.31 rows=1 width=10) (actual time=0.002..0.002 rows=0 loops=20)

  • Index Cond: (cd_ctrc = cf.cd_ctrc)
125. 0.100 0.100 ↓ 0.0 0 20

Index Scan using idx_carta_frete_vale_pedagio_cd_ctrc on carta_frete_vale_pedagio cfvp (cost=0.42..0.45 rows=1 width=9) (actual time=0.005..0.005 rows=0 loops=20)

  • Index Cond: (cd_ctrc = c_1.cd_ctrc)
126.          

CTE with_vl_peso_chegada

127. 0.015 53.456 ↓ 2.0 2 1

GroupAggregate (cost=114.71..114.74 rows=1 width=36) (actual time=53.455..53.456 rows=2 loops=1)

  • Group Key: ct_1.nr_embarque
128. 0.016 53.441 ↓ 2.0 2 1

Sort (cost=114.71..114.72 rows=1 width=10) (actual time=53.441..53.441 rows=2 loops=1)

  • Sort Key: ct_1.nr_embarque
  • Sort Method: quicksort Memory: 25kB
129. 0.031 53.425 ↓ 2.0 2 1

Nested Loop (cost=0.43..114.70 rows=1 width=10) (actual time=21.148..53.425 rows=2 loops=1)

130. 53.134 53.134 ↑ 2.1 20 1

CTE Scan on with_tmp_carta_frete_pagamento wcfp (cost=0.00..0.86 rows=43 width=4) (actual time=0.000..53.134 rows=20 loops=1)

131. 0.260 0.260 ↓ 0.0 0 20

Index Scan using pk_ctrc on ctrc ct_1 (cost=0.43..2.65 rows=1 width=14) (actual time=0.013..0.013 rows=0 loops=20)

  • Index Cond: (cd_ctrc = wcfp.cd_ctrc)
  • Filter: (nr_embarque IS NOT NULL)
  • Rows Removed by Filter: 1
132.          

CTE with_carta_frete_pagamento

133. 0.084 29,082.336 ↑ 2.1 20 1

Sort (cost=2.98..3.09 rows=43 width=564) (actual time=29,082.334..29,082.336 rows=20 loops=1)

  • Sort Key: wcfp_1.nr_titulo, wcfp_1.id_tipo, wcfp_1.nr_carta_frete
  • Sort Method: quicksort Memory: 30kB
134. 0.047 29,082.252 ↑ 2.1 20 1

Hash Left Join (cost=0.03..1.82 rows=43 width=564) (actual time=29,082.223..29,082.252 rows=20 loops=1)

  • Hash Cond: (wcfp_1.nr_embarque = wvpc.nr_embarque)
135. 29,028.739 29,028.739 ↑ 2.1 20 1

CTE Scan on with_tmp_carta_frete_pagamento wcfp_1 (cost=0.00..0.86 rows=43 width=550) (actual time=29,028.732..29,028.739 rows=20 loops=1)

136. 0.004 53.466 ↓ 2.0 2 1

Hash (cost=0.02..0.02 rows=1 width=36) (actual time=53.466..53.466 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
137. 53.462 53.462 ↓ 2.0 2 1

CTE Scan on with_vl_peso_chegada wvpc (cost=0.00..0.02 rows=1 width=36) (actual time=53.459..53.462 rows=2 loops=1)

138.          

CTE with_contrato_frete_pagamento

139. 0.001 0.041 ↓ 0.0 0 1

Nested Loop (cost=1,715.19..1,720.03 rows=1 width=219) (actual time=0.041..0.041 rows=0 loops=1)

140. 0.001 0.040 ↓ 0.0 0 1

Nested Loop (cost=1,714.76..1,717.54 rows=1 width=81) (actual time=0.040..0.040 rows=0 loops=1)

141. 0.007 0.039 ↓ 0.0 0 1

Hash Join (cost=1,714.34..1,715.09 rows=1 width=60) (actual time=0.039..0.039 rows=0 loops=1)

  • Hash Cond: (p_4.cd_pessoa = cf_1.cd_pessoa_filial)
142. 0.000 0.000 ↓ 0.0 0

Unique (cost=1,704.14..1,704.58 rows=22 width=101) (never executed)

143. 0.000 0.000 ↓ 0.0 0

Sort (cost=1,704.14..1,704.20 rows=22 width=101) (never executed)

  • Sort Key: p_4.nm_fantasia, p_4.cd_pessoa, p_4.cd_cidade, (((ci_4.nm_cidade || ' / '::text) || (uf_3.ds_sigla)::text)), pj_2.nr_cnpj, (substr((pj_2.nr_cnpj)::text, 1, 8)), (COALESCE((SubPlan 10), f_3.cd_pessoa_matriz))
144. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.42..1,703.65 rows=22 width=101) (never executed)

145. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.27..143.40 rows=22 width=53) (never executed)

146. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.99..136.79 rows=22 width=37) (never executed)

147. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.57..78.71 rows=22 width=23) (never executed)

  • Join Filter: (pg_1.cd_empresa = f_3.cd_pessoa_matriz)
148. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.57..57.03 rows=22 width=23) (never executed)

149. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=1.27..2.71 rows=22 width=8) (never executed)

  • Hash Cond: (f_3.cd_pessoa_matriz = eg_2.cd_pessoa)
150. 0.000 0.000 ↓ 0.0 0

Seq Scan on filial f_3 (cost=0.00..1.34 rows=27 width=8) (never executed)

  • Filter: (id_ativo = 1)
151. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.15..1.15 rows=10 width=4) (never executed)

152. 0.000 0.000 ↓ 0.0 0

Seq Scan on empresa_grupo eg_2 (cost=0.00..1.15 rows=10 width=4) (never executed)

  • Filter: (id_ativo = 1)
153. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_juridica on pessoa_juridica pj_2 (cost=0.29..2.47 rows=1 width=19) (never executed)

  • Index Cond: (cd_pessoa = f_3.cd_pessoa_filial)
154. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.00..21.03 rows=2 width=4) (never executed)

155. 0.000 0.000 ↓ 0.0 0

Seq Scan on parametro_geral pg_1 (cost=0.00..21.02 rows=2 width=4) (never executed)

156. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa p_4 (cost=0.42..2.64 rows=1 width=18) (never executed)

  • Index Cond: (cd_pessoa = f_3.cd_pessoa_filial)
157. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_cidade on cidade ci_4 (cost=0.28..0.30 rows=1 width=20) (never executed)

  • Index Cond: (cd_cidade = p_4.cd_cidade)
158. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_uf on uf uf_3 (cost=0.14..0.16 rows=1 width=7) (never executed)

  • Index Cond: (cd_uf = ci_4.cd_uf)
159.          

SubPlan (forNested Loop)

160. 0.000 0.000 ↓ 0.0 0

Limit (cost=70.74..70.75 rows=1 width=4) (never executed)

161. 0.000 0.000 ↓ 0.0 0

Unique (cost=70.74..70.75 rows=1 width=4) (never executed)

162. 0.000 0.000 ↓ 0.0 0

Sort (cost=70.74..70.74 rows=1 width=4) (never executed)

  • Sort Key: p_1_2.cd_pessoa
163. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.71..70.73 rows=1 width=4) (never executed)

  • Join Filter: (f_1_2.cd_pessoa_filial = p_1_2.cd_pessoa)
164. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.29..68.35 rows=1 width=8) (never executed)

165. 0.000 0.000 ↓ 0.0 0

Seq Scan on filial f_1_2 (cost=0.00..1.27 rows=27 width=4) (never executed)

166. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_juridica on pessoa_juridica pjm_2 (cost=0.29..2.48 rows=1 width=4) (never executed)

  • Index Cond: (cd_pessoa = f_1_2.cd_pessoa_filial)
  • Filter: (substr((nr_cnpj)::text, 1, 12) = (substr((pj_2.nr_cnpj)::text, 1, 8) || '0001'::text))
167. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pk_pessoa on pessoa p_1_2 (cost=0.42..2.36 rows=1 width=4) (never executed)

  • Index Cond: (cd_pessoa = pjm_2.cd_pessoa)
  • Heap Fetches: 0
168. 0.001 0.032 ↓ 0.0 0 1

Hash (cost=10.11..10.11 rows=7 width=54) (actual time=0.032..0.032 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
169. 0.001 0.031 ↓ 0.0 0 1

Nested Loop (cost=1.60..10.11 rows=7 width=54) (actual time=0.031..0.031 rows=0 loops=1)

170. 0.000 0.030 ↓ 0.0 0 1

Nested Loop (cost=1.45..8.84 rows=7 width=46) (actual time=0.030..0.030 rows=0 loops=1)

171. 0.012 0.030 ↓ 0.0 0 1

Nested Loop (cost=1.31..7.62 rows=7 width=22) (actual time=0.030..0.030 rows=0 loops=1)

172. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on with_movimento wm_2 (cost=0.00..0.02 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=1)

173. 0.006 0.017 ↓ 0.0 0 1

Bitmap Heap Scan on contrato_frete_pagamento cfp (cost=1.31..7.53 rows=7 width=18) (actual time=0.017..0.017 rows=0 loops=1)

  • Recheck Cond: (cd_movimento = wm_2.cd_movimento)
174. 0.011 0.011 ↓ 0.0 0 1

Bitmap Index Scan on idx_contrato_frete_pagamento_cd_movimento (cost=0.00..1.31 rows=7 width=0) (actual time=0.011..0.011 rows=0 loops=1)

  • Index Cond: (cd_movimento = wm_2.cd_movimento)
175. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contrato_frete on contrato_frete cf_1 (cost=0.15..0.17 rows=1 width=24) (never executed)

  • Index Cond: (cd_contrato = cfp.cd_contrato)
176. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contrato_frete_parcelamento on contrato_frete_parcelamento cfpar (cost=0.15..0.18 rows=1 width=26) (never executed)

  • Index Cond: ((cd_contrato = cfp.cd_contrato) AND (id_tipo = cfp.id_tipo) AND (nr_parcela = cfp.nr_parcela))
177. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa pu_1 (cost=0.42..2.45 rows=1 width=29) (never executed)

  • Index Cond: (cd_pessoa = cf_1.cd_pessoa_usuario)
178. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_veiculo on veiculo v_1 (cost=0.42..2.48 rows=1 width=11) (never executed)

  • Index Cond: (cd_veiculo = cf_1.cd_veiculo)
179.          

CTE with_despesa

180. 0.012 4.952 ↑ 5.0 1 1

Nested Loop Left Join (cost=1,639.96..1,647.23 rows=5 width=168) (actual time=4.939..4.952 rows=1 loops=1)

181. 0.006 4.907 ↑ 5.0 1 1

Nested Loop Left Join (cost=1,639.82..1,646.31 rows=5 width=81) (actual time=4.894..4.907 rows=1 loops=1)

182. 0.006 4.894 ↑ 5.0 1 1

Nested Loop Left Join (cost=1,639.39..1,643.83 rows=5 width=78) (actual time=4.882..4.894 rows=1 loops=1)

183. 0.005 3.825 ↑ 5.0 1 1

Nested Loop Left Join (cost=1,638.97..1,641.62 rows=5 width=78) (actual time=3.813..3.825 rows=1 loops=1)

184. 0.019 3.806 ↑ 5.0 1 1

Hash Join (cost=1,638.55..1,639.37 rows=5 width=57) (actual time=3.794..3.806 rows=1 loops=1)

  • Hash Cond: (p_5.cd_pessoa = c_2.cd_pessoa_filial)
185. 0.015 3.718 ↓ 1.1 25 1

Unique (cost=1,635.30..1,635.74 rows=22 width=101) (actual time=3.700..3.718 rows=25 loops=1)

186. 0.059 3.703 ↓ 1.1 25 1

Sort (cost=1,635.30..1,635.35 rows=22 width=101) (actual time=3.699..3.703 rows=25 loops=1)

  • Sort Key: p_5.nm_fantasia, p_5.cd_pessoa, p_5.cd_cidade, (((ci_5.nm_cidade || ' / '::text) || (uf_4.ds_sigla)::text)), pj_3.nr_cnpj, (substr((pj_3.nr_cnpj)::text, 1, 8)), (COALESCE((SubPlan 12), f_4.cd_pessoa_matriz))
  • Sort Method: quicksort Memory: 28kB
187. 0.055 3.644 ↓ 1.1 25 1

Nested Loop (cost=2.42..1,634.81 rows=22 width=101) (actual time=0.393..3.644 rows=25 loops=1)

188. 0.029 0.614 ↓ 1.1 25 1

Nested Loop (cost=2.27..74.55 rows=22 width=53) (actual time=0.109..0.614 rows=25 loops=1)

189. 0.021 0.460 ↓ 1.1 25 1

Nested Loop (cost=1.99..67.95 rows=22 width=37) (actual time=0.092..0.460 rows=25 loops=1)

  • Join Filter: (f_4.cd_pessoa_filial = pj_3.cd_pessoa)
190. 0.031 0.339 ↓ 1.1 25 1

Nested Loop (cost=1.70..60.79 rows=22 width=26) (actual time=0.071..0.339 rows=25 loops=1)

191. 0.024 0.058 ↓ 1.1 25 1

Hash Join (cost=1.27..2.71 rows=22 width=8) (actual time=0.038..0.058 rows=25 loops=1)

  • Hash Cond: (f_4.cd_pessoa_matriz = eg_3.cd_pessoa)
192. 0.018 0.018 ↑ 1.0 27 1

Seq Scan on filial f_4 (cost=0.00..1.34 rows=27 width=8) (actual time=0.011..0.018 rows=27 loops=1)

  • Filter: (id_ativo = 1)
193. 0.004 0.016 ↑ 1.0 10 1

Hash (cost=1.15..1.15 rows=10 width=4) (actual time=0.016..0.016 rows=10 loops=1)

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

Seq Scan on empresa_grupo eg_3 (cost=0.00..1.15 rows=10 width=4) (actual time=0.009..0.012 rows=10 loops=1)

  • Filter: (id_ativo = 1)
  • Rows Removed by Filter: 2
195. 0.250 0.250 ↑ 1.0 1 25

Index Scan using pk_pessoa on pessoa p_5 (cost=0.42..2.64 rows=1 width=18) (actual time=0.010..0.010 rows=1 loops=25)

  • Index Cond: (cd_pessoa = f_4.cd_pessoa_filial)
196. 0.100 0.100 ↑ 1.0 1 25

Index Scan using pk_pessoa_juridica on pessoa_juridica pj_3 (cost=0.29..0.31 rows=1 width=19) (actual time=0.004..0.004 rows=1 loops=25)

  • Index Cond: (cd_pessoa = p_5.cd_pessoa)
197. 0.125 0.125 ↑ 1.0 1 25

Index Scan using pk_cidade on cidade ci_5 (cost=0.28..0.30 rows=1 width=20) (actual time=0.005..0.005 rows=1 loops=25)

  • Index Cond: (cd_cidade = p_5.cd_cidade)
198. 0.050 0.050 ↑ 1.0 1 25

Index Scan using pk_uf on uf uf_4 (cost=0.14..0.16 rows=1 width=7) (actual time=0.002..0.002 rows=1 loops=25)

  • Index Cond: (cd_uf = ci_5.cd_uf)
199.          

SubPlan (forNested Loop)

200. 0.050 2.925 ↑ 1.0 1 25

Limit (cost=70.74..70.75 rows=1 width=4) (actual time=0.116..0.117 rows=1 loops=25)

201. 0.000 2.875 ↑ 1.0 1 25

Unique (cost=70.74..70.75 rows=1 width=4) (actual time=0.115..0.115 rows=1 loops=25)

202. 0.075 2.875 ↑ 1.0 1 25

Sort (cost=70.74..70.74 rows=1 width=4) (actual time=0.114..0.115 rows=1 loops=25)

  • Sort Key: p_1_3.cd_pessoa
  • Sort Method: quicksort Memory: 25kB
203. 0.075 2.800 ↑ 1.0 1 25

Nested Loop (cost=0.71..70.73 rows=1 width=4) (actual time=0.036..0.112 rows=1 loops=25)

  • Join Filter: (f_1_3.cd_pessoa_filial = p_1_3.cd_pessoa)
204. 0.475 2.625 ↑ 1.0 1 25

Nested Loop (cost=0.29..68.35 rows=1 width=8) (actual time=0.030..0.105 rows=1 loops=25)

205. 0.125 0.125 ↑ 1.0 27 25

Seq Scan on filial f_1_3 (cost=0.00..1.27 rows=27 width=4) (actual time=0.001..0.005 rows=27 loops=25)

206. 2.025 2.025 ↓ 0.0 0 675

Index Scan using pk_pessoa_juridica on pessoa_juridica pjm_3 (cost=0.29..2.48 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=675)

  • Index Cond: (cd_pessoa = f_1_3.cd_pessoa_filial)
  • Filter: (substr((nr_cnpj)::text, 1, 12) = (substr((pj_3.nr_cnpj)::text, 1, 8) || '0001'::text))
  • Rows Removed by Filter: 1
207. 0.100 0.100 ↑ 1.0 1 25

Index Only Scan using pk_pessoa on pessoa p_1_3 (cost=0.42..2.36 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=25)

  • Index Cond: (cd_pessoa = pjm_3.cd_pessoa)
  • Heap Fetches: 25
208. 0.003 0.069 ↑ 5.0 1 1

Hash (cost=3.19..3.19 rows=5 width=51) (actual time=0.069..0.069 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
209. 0.005 0.066 ↑ 5.0 1 1

Nested Loop (cost=0.42..3.19 rows=5 width=51) (actual time=0.064..0.066 rows=1 loops=1)

210. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on with_movimento wm_3 (cost=0.00..0.02 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=1)

211. 0.060 0.060 ↑ 5.0 1 1

Index Scan using idx_caixa_cd_movimento on caixa c_2 (cost=0.42..3.12 rows=5 width=47) (actual time=0.059..0.060 rows=1 loops=1)

  • Index Cond: (cd_movimento = wm_3.cd_movimento)
212. 0.014 0.014 ↑ 1.0 1 1

Index Scan using pk_pessoa on pessoa pu_2 (cost=0.42..0.45 rows=1 width=29) (actual time=0.014..0.014 rows=1 loops=1)

  • Index Cond: (cd_pessoa = c_2.cd_pessoa_usuario)
213. 1.063 1.063 ↓ 0.0 0 1

Index Scan using pk_caixa_veiculo on caixa_veiculo cv (cost=0.42..0.44 rows=1 width=8) (actual time=1.063..1.063 rows=0 loops=1)

  • Index Cond: (cd_caixa = c_2.cd_caixa)
214. 0.007 0.007 ↓ 0.0 0 1

Index Scan using pk_veiculo on veiculo v_2 (cost=0.42..0.50 rows=1 width=11) (actual time=0.007..0.007 rows=0 loops=1)

  • Index Cond: (cd_veiculo = cv.cd_veiculo)
215. 0.033 0.033 ↑ 1.0 1 1

Index Scan using pk_historico_caixa on historico_caixa hc (cost=0.15..0.17 rows=1 width=31) (actual time=0.033..0.033 rows=1 loops=1)

  • Index Cond: (cd_historico = c_2.cd_historico)
216.          

CTE with_viagem_valor

217. 0.002 13.365 ↓ 0.0 0 1

Nested Loop (cost=1,637.22..2,648.22 rows=1 width=166) (actual time=13.364..13.365 rows=0 loops=1)

218. 0.001 13.363 ↓ 0.0 0 1

Nested Loop (cost=1,636.80..2,646.96 rows=1 width=39) (actual time=13.363..13.363 rows=0 loops=1)

219. 0.002 13.362 ↓ 0.0 0 1

Nested Loop (cost=1,636.38..2,645.52 rows=1 width=36) (actual time=13.362..13.362 rows=0 loops=1)

220. 2.852 13.360 ↓ 0.0 0 1

Hash Join (cost=1,636.09..2,645.22 rows=1 width=32) (actual time=13.360..13.360 rows=0 loops=1)

  • Hash Cond: (vv.cd_movimento = wm_4.cd_movimento)
221. 6.977 6.977 ↓ 1.0 37,201 1

Seq Scan on viagem_valor vv (cost=0.00..869.72 rows=37,172 width=18) (actual time=0.014..6.977 rows=37,201 loops=1)

222. 0.004 3.531 ↑ 1.0 1 1

Hash (cost=1,636.08..1,636.08 rows=1 width=18) (actual time=3.531..3.531 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
223. 0.015 3.527 ↑ 1.0 1 1

Hash Join (cost=1,635.33..1,636.08 rows=1 width=18) (actual time=3.518..3.527 rows=1 loops=1)

  • Hash Cond: (p_6.cd_pessoa = wm_4.cd_pessoa_filial)
224. 0.013 3.507 ↓ 1.1 25 1

Unique (cost=1,635.30..1,635.74 rows=22 width=101) (actual time=3.493..3.507 rows=25 loops=1)

225. 0.057 3.494 ↓ 1.1 25 1

Sort (cost=1,635.30..1,635.35 rows=22 width=101) (actual time=3.492..3.494 rows=25 loops=1)

  • Sort Key: p_6.nm_fantasia, p_6.cd_pessoa, p_6.cd_cidade, (((ci_6.nm_cidade || ' / '::text) || (uf_5.ds_sigla)::text)), pj_4.nr_cnpj, (substr((pj_4.nr_cnpj)::text, 1, 8)), (COALESCE((SubPlan 14), f_5.cd_pessoa_matriz))
  • Sort Method: quicksort Memory: 28kB
226. 0.070 3.437 ↓ 1.1 25 1

Nested Loop (cost=2.42..1,634.81 rows=22 width=101) (actual time=0.319..3.437 rows=25 loops=1)

227. 0.035 0.567 ↓ 1.1 25 1

Nested Loop (cost=2.27..74.55 rows=22 width=53) (actual time=0.096..0.567 rows=25 loops=1)

228. 0.012 0.407 ↓ 1.1 25 1

Nested Loop (cost=1.99..67.95 rows=22 width=37) (actual time=0.061..0.407 rows=25 loops=1)

  • Join Filter: (f_5.cd_pessoa_filial = pj_4.cd_pessoa)
229. 0.020 0.320 ↓ 1.1 25 1

Nested Loop (cost=1.70..60.79 rows=22 width=26) (actual time=0.048..0.320 rows=25 loops=1)

230. 0.021 0.050 ↓ 1.1 25 1

Hash Join (cost=1.27..2.71 rows=22 width=8) (actual time=0.029..0.050 rows=25 loops=1)

  • Hash Cond: (f_5.cd_pessoa_matriz = eg_4.cd_pessoa)
231. 0.015 0.015 ↑ 1.0 27 1

Seq Scan on filial f_5 (cost=0.00..1.34 rows=27 width=8) (actual time=0.009..0.015 rows=27 loops=1)

  • Filter: (id_ativo = 1)
232. 0.003 0.014 ↑ 1.0 10 1

Hash (cost=1.15..1.15 rows=10 width=4) (actual time=0.014..0.014 rows=10 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
233. 0.011 0.011 ↑ 1.0 10 1

Seq Scan on empresa_grupo eg_4 (cost=0.00..1.15 rows=10 width=4) (actual time=0.008..0.011 rows=10 loops=1)

  • Filter: (id_ativo = 1)
  • Rows Removed by Filter: 2
234. 0.250 0.250 ↑ 1.0 1 25

Index Scan using pk_pessoa on pessoa p_6 (cost=0.42..2.64 rows=1 width=18) (actual time=0.010..0.010 rows=1 loops=25)

  • Index Cond: (cd_pessoa = f_5.cd_pessoa_filial)
235. 0.075 0.075 ↑ 1.0 1 25

Index Scan using pk_pessoa_juridica on pessoa_juridica pj_4 (cost=0.29..0.31 rows=1 width=19) (actual time=0.003..0.003 rows=1 loops=25)

  • Index Cond: (cd_pessoa = p_6.cd_pessoa)
236. 0.125 0.125 ↑ 1.0 1 25

Index Scan using pk_cidade on cidade ci_6 (cost=0.28..0.30 rows=1 width=20) (actual time=0.005..0.005 rows=1 loops=25)

  • Index Cond: (cd_cidade = p_6.cd_cidade)
237. 0.050 0.050 ↑ 1.0 1 25

Index Scan using pk_uf on uf uf_5 (cost=0.14..0.16 rows=1 width=7) (actual time=0.002..0.002 rows=1 loops=25)

  • Index Cond: (cd_uf = ci_6.cd_uf)
238.          

SubPlan (forNested Loop)

239. 0.025 2.750 ↑ 1.0 1 25

Limit (cost=70.74..70.75 rows=1 width=4) (actual time=0.109..0.110 rows=1 loops=25)

240. 0.025 2.725 ↑ 1.0 1 25

Unique (cost=70.74..70.75 rows=1 width=4) (actual time=0.109..0.109 rows=1 loops=25)

241. 0.075 2.700 ↑ 1.0 1 25

Sort (cost=70.74..70.74 rows=1 width=4) (actual time=0.108..0.108 rows=1 loops=25)

  • Sort Key: p_1_4.cd_pessoa
  • Sort Method: quicksort Memory: 25kB
242. 0.075 2.625 ↑ 1.0 1 25

Nested Loop (cost=0.71..70.73 rows=1 width=4) (actual time=0.039..0.105 rows=1 loops=25)

  • Join Filter: (f_1_4.cd_pessoa_filial = p_1_4.cd_pessoa)
243. 0.325 2.475 ↑ 1.0 1 25

Nested Loop (cost=0.29..68.35 rows=1 width=8) (actual time=0.033..0.099 rows=1 loops=25)

244. 0.125 0.125 ↑ 1.0 27 25

Seq Scan on filial f_1_4 (cost=0.00..1.27 rows=27 width=4) (actual time=0.001..0.005 rows=27 loops=25)

245. 2.025 2.025 ↓ 0.0 0 675

Index Scan using pk_pessoa_juridica on pessoa_juridica pjm_4 (cost=0.29..2.48 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=675)

  • Index Cond: (cd_pessoa = f_1_4.cd_pessoa_filial)
  • Filter: (substr((nr_cnpj)::text, 1, 12) = (substr((pj_4.nr_cnpj)::text, 1, 8) || '0001'::text))
  • Rows Removed by Filter: 1
246. 0.075 0.075 ↑ 1.0 1 25

Index Only Scan using pk_pessoa on pessoa p_1_4 (cost=0.42..2.36 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=25)

  • Index Cond: (cd_pessoa = pjm_4.cd_pessoa)
  • Heap Fetches: 25
247. 0.002 0.005 ↑ 1.0 1 1

Hash (cost=0.02..0.02 rows=1 width=12) (actual time=0.005..0.005 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
248. 0.003 0.003 ↑ 1.0 1 1

CTE Scan on with_movimento wm_4 (cost=0.00..0.02 rows=1 width=12) (actual time=0.002..0.003 rows=1 loops=1)

249. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_viagem on viagem v_3 (cost=0.28..0.30 rows=1 width=12) (never executed)

  • Index Cond: (cd_viagem = vv.cd_viagem)
250. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_veiculo on veiculo ve (cost=0.42..1.44 rows=1 width=11) (never executed)

  • Index Cond: (cd_veiculo = v_3.cd_veiculo)
251. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa pu_3 (cost=0.42..1.25 rows=1 width=29) (never executed)

  • Index Cond: (cd_pessoa = v_3.cd_pessoa_usuario_abertura)
252.          

CTE with_valores_rh

253. 0.003 47.379 ↓ 0.0 0 1

Nested Loop (cost=1,636.52..6,000.96 rows=1 width=191) (actual time=47.379..47.379 rows=0 loops=1)

254. 13.608 47.376 ↓ 0.0 0 1

Hash Join (cost=1,636.09..6,000.47 rows=1 width=32) (actual time=47.376..47.376 rows=0 loops=1)

  • Hash Cond: (pce.cd_movimento = wm_5.cd_movimento)
255. 30.324 30.324 ↑ 1.0 177,831 1

Seq Scan on pessoa_credito_efetuado pce (cost=0.00..3,695.27 rows=178,427 width=18) (actual time=0.028..30.324 rows=177,831 loops=1)

256. 0.004 3.444 ↑ 1.0 1 1

Hash (cost=1,636.08..1,636.08 rows=1 width=18) (actual time=3.444..3.444 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
257. 0.016 3.440 ↑ 1.0 1 1

Hash Join (cost=1,635.33..1,636.08 rows=1 width=18) (actual time=3.433..3.440 rows=1 loops=1)

  • Hash Cond: (p_7.cd_pessoa = wm_5.cd_pessoa_filial)
258. 0.013 3.415 ↓ 1.1 25 1

Unique (cost=1,635.30..1,635.74 rows=22 width=101) (actual time=3.401..3.415 rows=25 loops=1)

259. 0.060 3.402 ↓ 1.1 25 1

Sort (cost=1,635.30..1,635.35 rows=22 width=101) (actual time=3.399..3.402 rows=25 loops=1)

  • Sort Key: p_7.nm_fantasia, p_7.cd_pessoa, p_7.cd_cidade, (((ci_7.nm_cidade || ' / '::text) || (uf_6.ds_sigla)::text)), pj_5.nr_cnpj, (substr((pj_5.nr_cnpj)::text, 1, 8)), (COALESCE((SubPlan 16), f_6.cd_pessoa_matriz))
  • Sort Method: quicksort Memory: 28kB
260. 0.051 3.342 ↓ 1.1 25 1

Nested Loop (cost=2.42..1,634.81 rows=22 width=101) (actual time=0.398..3.342 rows=25 loops=1)

261. 0.022 0.566 ↓ 1.1 25 1

Nested Loop (cost=2.27..74.55 rows=22 width=53) (actual time=0.110..0.566 rows=25 loops=1)

262. 0.015 0.419 ↓ 1.1 25 1

Nested Loop (cost=1.99..67.95 rows=22 width=37) (actual time=0.088..0.419 rows=25 loops=1)

  • Join Filter: (f_6.cd_pessoa_filial = pj_5.cd_pessoa)
263. 0.024 0.329 ↓ 1.1 25 1

Nested Loop (cost=1.70..60.79 rows=22 width=26) (actual time=0.069..0.329 rows=25 loops=1)

264. 0.022 0.055 ↓ 1.1 25 1

Hash Join (cost=1.27..2.71 rows=22 width=8) (actual time=0.037..0.055 rows=25 loops=1)

  • Hash Cond: (f_6.cd_pessoa_matriz = eg_5.cd_pessoa)
265. 0.016 0.016 ↑ 1.0 27 1

Seq Scan on filial f_6 (cost=0.00..1.34 rows=27 width=8) (actual time=0.011..0.016 rows=27 loops=1)

  • Filter: (id_ativo = 1)
266. 0.005 0.017 ↑ 1.0 10 1

Hash (cost=1.15..1.15 rows=10 width=4) (actual time=0.017..0.017 rows=10 loops=1)

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

Seq Scan on empresa_grupo eg_5 (cost=0.00..1.15 rows=10 width=4) (actual time=0.009..0.012 rows=10 loops=1)

  • Filter: (id_ativo = 1)
  • Rows Removed by Filter: 2
268. 0.250 0.250 ↑ 1.0 1 25

Index Scan using pk_pessoa on pessoa p_7 (cost=0.42..2.64 rows=1 width=18) (actual time=0.010..0.010 rows=1 loops=25)

  • Index Cond: (cd_pessoa = f_6.cd_pessoa_filial)
269. 0.075 0.075 ↑ 1.0 1 25

Index Scan using pk_pessoa_juridica on pessoa_juridica pj_5 (cost=0.29..0.31 rows=1 width=19) (actual time=0.003..0.003 rows=1 loops=25)

  • Index Cond: (cd_pessoa = p_7.cd_pessoa)
270. 0.125 0.125 ↑ 1.0 1 25

Index Scan using pk_cidade on cidade ci_7 (cost=0.28..0.30 rows=1 width=20) (actual time=0.005..0.005 rows=1 loops=25)

  • Index Cond: (cd_cidade = p_7.cd_cidade)
271. 0.050 0.050 ↑ 1.0 1 25

Index Scan using pk_uf on uf uf_6 (cost=0.14..0.16 rows=1 width=7) (actual time=0.002..0.002 rows=1 loops=25)

  • Index Cond: (cd_uf = ci_7.cd_uf)
272.          

SubPlan (forNested Loop)

273. 0.050 2.675 ↑ 1.0 1 25

Limit (cost=70.74..70.75 rows=1 width=4) (actual time=0.106..0.107 rows=1 loops=25)

274. 0.000 2.625 ↑ 1.0 1 25

Unique (cost=70.74..70.75 rows=1 width=4) (actual time=0.105..0.105 rows=1 loops=25)

275. 0.075 2.625 ↑ 1.0 1 25

Sort (cost=70.74..70.74 rows=1 width=4) (actual time=0.105..0.105 rows=1 loops=25)

  • Sort Key: p_1_5.cd_pessoa
  • Sort Method: quicksort Memory: 25kB
276. 0.075 2.550 ↑ 1.0 1 25

Nested Loop (cost=0.71..70.73 rows=1 width=4) (actual time=0.036..0.102 rows=1 loops=25)

  • Join Filter: (f_1_5.cd_pessoa_filial = p_1_5.cd_pessoa)
277. 0.250 2.400 ↑ 1.0 1 25

Nested Loop (cost=0.29..68.35 rows=1 width=8) (actual time=0.030..0.096 rows=1 loops=25)

278. 0.125 0.125 ↑ 1.0 27 25

Seq Scan on filial f_1_5 (cost=0.00..1.27 rows=27 width=4) (actual time=0.001..0.005 rows=27 loops=25)

279. 2.025 2.025 ↓ 0.0 0 675

Index Scan using pk_pessoa_juridica on pessoa_juridica pjm_5 (cost=0.29..2.48 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=675)

  • Index Cond: (cd_pessoa = f_1_5.cd_pessoa_filial)
  • Filter: (substr((nr_cnpj)::text, 1, 12) = (substr((pj_5.nr_cnpj)::text, 1, 8) || '0001'::text))
  • Rows Removed by Filter: 1
280. 0.075 0.075 ↑ 1.0 1 25

Index Only Scan using pk_pessoa on pessoa p_1_5 (cost=0.42..2.36 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=25)

  • Index Cond: (cd_pessoa = pjm_5.cd_pessoa)
  • Heap Fetches: 25
281. 0.004 0.009 ↑ 1.0 1 1

Hash (cost=0.02..0.02 rows=1 width=12) (actual time=0.009..0.009 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
282. 0.005 0.005 ↑ 1.0 1 1

CTE Scan on with_movimento wm_5 (cost=0.00..0.02 rows=1 width=12) (actual time=0.005..0.005 rows=1 loops=1)

283. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa pu_4 (cost=0.42..0.48 rows=1 width=29) (never executed)

  • Index Cond: (cd_pessoa = pce.cd_pessoa_usuario)
284.          

CTE with_titulo_detalhamentos

285. 0.035 29,148.793 ↓ 4.2 21 1

Sort (cost=1.50..1.52 rows=5 width=42) (actual time=29,148.791..29,148.793 rows=21 loops=1)

  • Sort Key: wm_6.cd_titulo, wcfp_2.dt_recebimento, wcfp_2.id_tipo
  • Sort Method: quicksort Memory: 45kB
286. 0.011 29,148.758 ↓ 4.2 21 1

Append (cost=0.03..1.44 rows=5 width=42) (actual time=29,082.478..29,148.758 rows=21 loops=1)

287. 0.424 29,082.876 ↓ 20.0 20 1

Hash Join (cost=0.03..1.07 rows=1 width=42) (actual time=29,082.476..29,082.876 rows=20 loops=1)

  • Hash Cond: (wcfp_2.cd_titulo = wm_6.cd_titulo)
288. 29,082.445 29,082.445 ↑ 2.1 20 1

CTE Scan on with_carta_frete_pagamento wcfp_2 (cost=0.00..0.86 rows=43 width=44) (actual time=29,082.405..29,082.445 rows=20 loops=1)

289. 0.003 0.007 ↑ 1.0 1 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
290. 0.004 0.004 ↑ 1.0 1 1

CTE Scan on with_movimento wm_6 (cost=0.00..0.02 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1)

291. 0.002 0.045 ↓ 0.0 0 1

Nested Loop (cost=0.00..0.06 rows=1 width=42) (actual time=0.045..0.045 rows=0 loops=1)

  • Join Filter: (wm_7.cd_titulo = wcfp_3.cd_titulo)
292. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on with_movimento wm_7 (cost=0.00..0.02 rows=1 width=4) (actual time=0.000..0.001 rows=1 loops=1)

293. 0.042 0.042 ↓ 0.0 0 1

CTE Scan on with_contrato_frete_pagamento wcfp_3 (cost=0.00..0.02 rows=1 width=44) (actual time=0.042..0.042 rows=0 loops=1)

294. 0.047 5.061 ↑ 1.0 1 1

Hash Join (cost=0.03..0.16 rows=1 width=42) (actual time=5.046..5.061 rows=1 loops=1)

  • Hash Cond: (wd.cd_titulo = wm_8.cd_titulo)
295. 5.007 5.007 ↑ 5.0 1 1

CTE Scan on with_despesa wd (cost=0.00..0.10 rows=5 width=44) (actual time=4.994..5.007 rows=1 loops=1)

296. 0.003 0.007 ↑ 1.0 1 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
297. 0.004 0.004 ↑ 1.0 1 1

CTE Scan on with_movimento wm_8 (cost=0.00..0.02 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=1)

298. 0.004 13.373 ↓ 0.0 0 1

Nested Loop (cost=0.00..0.06 rows=1 width=42) (actual time=13.373..13.373 rows=0 loops=1)

  • Join Filter: (wm_9.cd_titulo = wvv.cd_titulo)
299. 0.003 0.003 ↑ 1.0 1 1

CTE Scan on with_movimento wm_9 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.003 rows=1 loops=1)

300. 13.366 13.366 ↓ 0.0 0 1

CTE Scan on with_viagem_valor wvv (cost=0.00..0.02 rows=1 width=44) (actual time=13.366..13.366 rows=0 loops=1)

301. 0.006 47.392 ↓ 0.0 0 1

Nested Loop (cost=0.00..0.06 rows=1 width=42) (actual time=47.392..47.392 rows=0 loops=1)

  • Join Filter: (wm_10.cd_titulo = wvv_1.cd_titulo)
302. 0.006 0.006 ↑ 1.0 1 1

CTE Scan on with_movimento wm_10 (cost=0.00..0.02 rows=1 width=4) (actual time=0.002..0.006 rows=1 loops=1)

303. 47.380 47.380 ↓ 0.0 0 1

CTE Scan on with_valores_rh wvv_1 (cost=0.00..0.02 rows=1 width=44) (actual time=47.380..47.380 rows=0 loops=1)

304.          

CTE with_titulo_detalhamento

305. 0.052 29,148.885 ↑ 5.0 1 1

HashAggregate (cost=0.12..0.19 rows=5 width=36) (actual time=29,148.884..29,148.885 rows=1 loops=1)

  • Group Key: wtd_1.cd_titulo
306. 29,148.833 29,148.833 ↓ 4.2 21 1

CTE Scan on with_titulo_detalhamentos wtd_1 (cost=0.00..0.10 rows=5 width=36) (actual time=29,148.804..29,148.833 rows=21 loops=1)

307. 4.731 29,274.010 ↑ 155.0 1 1

Hash Right Join (cost=0.17..736.57 rows=155 width=958) (actual time=29,192.951..29,274.010 rows=1 loops=1)

  • Hash Cond: (wc.cd_pessoa = wm.cd_pessoa)
308. 118.080 118.080 ↓ 1.1 32,766 1

CTE Scan on with_conta wc (cost=0.00..618.82 rows=30,941 width=36) (actual time=41.244..118.080 rows=32,766 loops=1)

309. 0.010 29,151.199 ↑ 1.0 1 1

Hash (cost=0.16..0.16 rows=1 width=926) (actual time=29,151.199..29,151.199 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
310. 0.014 29,151.189 ↑ 1.0 1 1

Hash Right Join (cost=0.03..0.16 rows=1 width=926) (actual time=29,151.184..29,151.189 rows=1 loops=1)

  • Hash Cond: (wtd.cd_titulo = wm.cd_titulo)
311. 29,148.895 29,148.895 ↑ 5.0 1 1

CTE Scan on with_titulo_detalhamento wtd (cost=0.00..0.10 rows=5 width=36) (actual time=29,148.893..29,148.895 rows=1 loops=1)

312. 0.003 2.280 ↑ 1.0 1 1

Hash (cost=0.02..0.02 rows=1 width=894) (actual time=2.280..2.280 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
313. 2.277 2.277 ↑ 1.0 1 1

CTE Scan on with_movimento wm (cost=0.00..0.02 rows=1 width=894) (actual time=2.268..2.277 rows=1 loops=1)

Planning time : 39.602 ms
Execution time : 29,340.172 ms