explain.depesz.com

PostgreSQL's explain analyze made readable

Result: cLFE

Settings
# exclusive inclusive rows x rows loops node
1. 0.097 1,107.395 ↓ 0.0 0 1

Sort (cost=191,235.56..191,235.56 rows=3 width=1,521) (actual time=1,107.395..1,107.395 rows=0 loops=1)

  • Sort Key: (CASE WHEN (cfpa.id_tipo = 5) THEN (cfd.dt_lancamento)::date ELSE cf.dt_emissao END), cf.nr_carta_frete, (CASE cfpa.id_tipo WHEN 0 THEN 'Adiantamento'::text WHEN 1 THEN 'Saldo'::text WHEN 2 THEN 'V. Comb.'::text WHEN 3 THEN 'Diária Viagem'::text WHEN 4 THEN 'Estadia Carregado'::text WHEN 5 THEN 'Diária Motorista'::text ELSE NULL::text END), cfp.dt_recebimento, (COALESCE((cfpa.nr_parcela)::integer, (cfp.nr_parcela)::integer, 1))
  • Sort Method: quicksort Memory: 25kB
2.          

CTE with_carta_frete_outros_descontos

3. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=19.54..30.78 rows=899 width=36) (never executed)

  • Group Key: cfod.cd_ctrc
4. 0.000 0.000 ↓ 0.0 0

Seq Scan on carta_frete_outros_descontos cfod (cost=0.00..15.03 rows=903 width=9) (never executed)

5. 0.005 1,107.298 ↓ 0.0 0 1

Append (cost=5,191.08..191,204.75 rows=3 width=1,521) (actual time=1,107.298..1,107.298 rows=0 loops=1)

6. 0.001 1,107.147 ↓ 0.0 0 1

Nested Loop (cost=5,191.08..182,595.08 rows=1 width=1,247) (actual time=1,107.147..1,107.147 rows=0 loops=1)

7. 0.001 1,107.146 ↓ 0.0 0 1

Nested Loop (cost=5,190.66..182,474.79 rows=1 width=739) (actual time=1,107.146..1,107.146 rows=0 loops=1)

8. 0.001 1,107.145 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,190.24..182,466.35 rows=1 width=743) (actual time=1,107.145..1,107.145 rows=0 loops=1)

  • Join Filter: (wcfod.cd_ctrc = cf.cd_ctrc)
9. 0.001 1,107.144 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,190.24..182,437.13 rows=1 width=711) (actual time=1,107.144..1,107.144 rows=0 loops=1)

10. 0.000 1,107.143 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,190.10..182,436.97 rows=1 width=700) (actual time=1,107.143..1,107.143 rows=0 loops=1)

11. 0.012 1,107.143 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,189.68..182,428.53 rows=1 width=679) (actual time=1,107.143..1,107.143 rows=0 loops=1)

12. 0.001 1,107.131 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,189.54..182,428.37 rows=1 width=676) (actual time=1,107.131..1,107.131 rows=0 loops=1)

13. 0.001 1,107.130 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,189.40..182,428.22 rows=1 width=660) (actual time=1,107.130..1,107.130 rows=0 loops=1)

14. 0.001 1,107.129 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,189.26..182,428.05 rows=1 width=661) (actual time=1,107.129..1,107.129 rows=0 loops=1)

15. 0.000 1,107.128 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,188.97..182,425.16 rows=1 width=649) (actual time=1,107.128..1,107.128 rows=0 loops=1)

16. 0.001 1,107.128 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,188.55..182,421.96 rows=1 width=620) (actual time=1,107.127..1,107.128 rows=0 loops=1)

17. 0.001 1,107.127 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,188.26..182,418.91 rows=1 width=612) (actual time=1,107.127..1,107.127 rows=0 loops=1)

18. 0.001 1,107.126 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,188.12..182,410.67 rows=1 width=599) (actual time=1,107.126..1,107.126 rows=0 loops=1)

19. 0.000 1,107.125 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,187.69..182,402.23 rows=1 width=574) (actual time=1,107.125..1,107.125 rows=0 loops=1)

20. 0.001 1,107.125 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,187.42..182,400.14 rows=1 width=555) (actual time=1,107.125..1,107.125 rows=0 loops=1)

21. 0.001 1,107.124 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,178.47..182,383.17 rows=1 width=549) (actual time=1,107.124..1,107.124 rows=0 loops=1)

  • Filter: CASE WHEN (cte.cd_ctrc IS NOT NULL) THEN (cte.cd_status = 100) ELSE true END
22. 0.001 1,107.123 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,178.04..182,374.71 rows=1 width=549) (actual time=1,107.123..1,107.123 rows=0 loops=1)

23. 0.001 1,107.122 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,177.62..182,366.27 rows=1 width=528) (actual time=1,107.122..1,107.122 rows=0 loops=1)

24. 0.001 1,107.121 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,177.20..182,357.83 rows=1 width=499) (actual time=1,107.121..1,107.121 rows=0 loops=1)

25. 0.000 1,107.120 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,176.92..182,355.39 rows=1 width=473) (actual time=1,107.120..1,107.120 rows=0 loops=1)

26. 0.001 1,107.120 ↓ 0.0 0 1

Nested Loop (cost=5,176.64..182,347.08 rows=1 width=467) (actual time=1,107.120..1,107.120 rows=0 loops=1)

27. 0.001 1,107.119 ↓ 0.0 0 1

Nested Loop (cost=5,176.21..182,342.54 rows=1 width=463) (actual time=1,107.119..1,107.119 rows=0 loops=1)

28. 0.000 1,107.118 ↓ 0.0 0 1

Nested Loop Left Join (cost=5,175.78..182,339.30 rows=1 width=461) (actual time=1,107.118..1,107.118 rows=0 loops=1)

29. 0.001 1,107.118 ↓ 0.0 0 1

Nested Loop (cost=5,175.35..182,335.97 rows=1 width=399) (actual time=1,107.117..1,107.118 rows=0 loops=1)

30. 0.000 1,107.117 ↓ 0.0 0 1

Hash Join (cost=5,174.92..182,328.61 rows=2 width=377) (actual time=1,107.116..1,107.117 rows=0 loops=1)

  • Hash Cond: (ct.cd_pessoa_filial = vw.cd_pessoa)
31. 51.628 1,127.138 ↓ 0.0 0 1

Gather (cost=1,011.78..178,165.45 rows=2 width=345) (actual time=1,107.114..1,127.138 rows=0 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
32. 0.001 1,075.510 ↓ 0.0 0 3 / 3

Nested Loop (cost=11.78..177,165.25 rows=1 width=345) (actual time=1,075.510..1,075.510 rows=0 loops=3)

33. 0.000 1,075.509 ↓ 0.0 0 3 / 3

Nested Loop (cost=11.36..177,156.81 rows=1 width=308) (actual time=1,075.509..1,075.509 rows=0 loops=3)

  • Join Filter: (cf.cd_ctrc = cfpa.cd_ctrc)
34. 0.001 1,075.509 ↓ 0.0 0 3 / 3

Nested Loop (cost=10.92..177,153.49 rows=1 width=235) (actual time=1,075.509..1,075.509 rows=0 loops=3)

35. 0.001 1,075.508 ↓ 0.0 0 3 / 3

Nested Loop (cost=10.49..177,149.52 rows=1 width=207) (actual time=1,075.508..1,075.508 rows=0 loops=3)

36. 0.001 1,075.507 ↓ 0.0 0 3 / 3

Nested Loop (cost=0.85..177,139.85 rows=1 width=175) (actual time=1,075.507..1,075.507 rows=0 loops=3)

37. 0.001 1,075.506 ↓ 0.0 0 3 / 3

Nested Loop (cost=0.42..177,131.40 rows=1 width=101) (actual time=1,075.506..1,075.506 rows=0 loops=3)

38. 1,075.505 1,075.505 ↓ 0.0 0 3 / 3

Parallel Seq Scan on ctrc ct (cost=0.00..177,122.96 rows=1 width=76) (actual time=1,075.505..1,075.505 rows=0 loops=3)

  • Filter: ((dt_cancelamento IS NULL) AND (cd_pessoa_matriz = 2))
  • Rows Removed by Filter: 1,048,138
39. 0.000 0.000 ↓ 0.0 0 / 3

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

  • Index Cond: (cd_pessoa = ct.cd_pessoa_pagador)
40. 0.000 0.000 ↓ 0.0 0 / 3

Index Scan using pk_carta_frete on carta_frete cf (cost=0.43..8.45 rows=1 width=74) (never executed)

  • Index Cond: (cd_ctrc = ct.cd_ctrc)
41. 0.000 0.000 ↓ 0.0 0 / 3

Sort (cost=9.64..9.64 rows=1 width=36) (never executed)

  • Sort Key: (COALESCE(p_1.nm_fantasia, p_1.nm_pessoa))
42. 0.000 0.000 ↓ 0.0 0 / 3

Nested Loop (cost=0.42..9.63 rows=1 width=36) (never executed)

43. 0.000 0.000 ↓ 0.0 0 / 3

Index Scan using pk_pessoa on pessoa p_1 (cost=0.42..8.44 rows=1 width=39) (never executed)

  • Index Cond: (cd_pessoa = 2)
44. 0.000 0.000 ↓ 0.0 0 / 3

Seq Scan on empresa_grupo eg (cost=0.00..1.18 rows=1 width=4) (never executed)

  • Filter: ((cd_pessoa = 2) AND (id_ativo = 1))
45. 0.000 0.000 ↓ 0.0 0 / 3

Index Scan using pk_carta_frete_pagamento on carta_frete_pagamento cfp (cost=0.43..3.95 rows=2 width=28) (never executed)

  • Index Cond: (cd_ctrc = cf.cd_ctrc)
46. 0.000 0.000 ↓ 0.0 0 / 3

Index Scan using pk_carta_frete_parcelamento on carta_frete_parcelamento cfpa (cost=0.43..3.31 rows=1 width=81) (never executed)

  • Index Cond: ((cd_ctrc = cfp.cd_ctrc) AND (id_tipo = cfp.id_tipo) AND (nr_parcela = cfp.nr_parcela))
47. 0.000 0.000 ↓ 0.0 0 / 3

Index Scan using pk_pessoa on pessoa pd (cost=0.42..8.44 rows=1 width=41) (never executed)

  • Index Cond: (cd_pessoa = ct.cd_pessoa_transportadora_doc)
48. 0.000 0.000 ↓ 0.0 0

Hash (cost=4,162.91..4,162.91 rows=18 width=36) (never executed)

49. 0.000 0.000 ↓ 0.0 0

Subquery Scan on vw (cost=4,162.37..4,162.91 rows=18 width=36) (never executed)

50. 0.000 0.000 ↓ 0.0 0

Unique (cost=4,162.37..4,162.73 rows=18 width=126) (never executed)

51. 0.000 0.000 ↓ 0.0 0

Sort (cost=4,162.37..4,162.42 rows=18 width=126) (never executed)

  • Sort Key: (COALESCE(p_2.nm_fantasia, p_2.nm_pessoa)), p_2.cd_pessoa, p_2.cd_cidade, (((ci.nm_cidade || ' / '::text) || (uf.ds_sigla)::text)), ((COALESCE(pj.nr_cnpj, pf.nr_cpf))::character varying(14)), (COALESCE(substr((pj.nr_cnpj)::text, 1, 8), (pf.nr_cpf)::text)), (COALESCE((SubPlan 13), f.cd_pessoa_matriz))
52. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.91..4,162.00 rows=18 width=126) (never executed)

53. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.77..462.29 rows=18 width=90) (never executed)

54. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.49..456.88 rows=18 width=74) (never executed)

55. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=2.06..304.96 rows=18 width=35) (never executed)

  • Join Filter: (pg.cd_empresa = f.cd_pessoa_matriz)
56. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=2.06..302.68 rows=18 width=35) (never executed)

57. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.64..150.76 rows=18 width=23) (never executed)

58. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=1.22..2.82 rows=18 width=8) (never executed)

  • Hash Cond: (f.cd_pessoa_matriz = eg_1.cd_pessoa)
59. 0.000 0.000 ↓ 0.0 0

Seq Scan on filial f (cost=0.00..1.46 rows=37 width=8) (never executed)

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

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

61. 0.000 0.000 ↓ 0.0 0

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

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

Index Scan using pk_pessoa_juridica on pessoa_juridica pj (cost=0.42..8.22 rows=1 width=19) (never executed)

  • Index Cond: (cd_pessoa = f.cd_pessoa_filial)
  • Filter: (nr_cnpj IS NOT NULL)
63. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_fisica on pessoa_fisica pf (cost=0.42..8.44 rows=1 width=16) (never executed)

  • Index Cond: (cd_pessoa = f.cd_pessoa_filial)
  • Filter: (nr_cpf IS NOT NULL)
64. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.00..2.01 rows=1 width=4) (never executed)

65. 0.000 0.000 ↓ 0.0 0

Seq Scan on parametro_geral pg (cost=0.00..2.01 rows=1 width=4) (never executed)

66. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa p_2 (cost=0.42..8.44 rows=1 width=43) (never executed)

  • Index Cond: (cd_pessoa = f.cd_pessoa_filial)
67. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_cidade = p_2.cd_cidade)
68. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_uf = ci.cd_uf)
69.          

SubPlan (for Nested Loop)

70. 0.000 0.000 ↓ 0.0 0

Limit (cost=205.35..205.36 rows=1 width=4) (never executed)

71. 0.000 0.000 ↓ 0.0 0

Unique (cost=205.35..205.36 rows=1 width=4) (never executed)

72. 0.000 0.000 ↓ 0.0 0

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

  • Sort Key: p_1_1.cd_pessoa
73. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.26..205.34 rows=1 width=4) (never executed)

  • Filter: ((substr((pjm.nr_cnpj)::text, 1, 12) = (substr((pj.nr_cnpj)::text, 1, 8) || '0001'::text)) OR (pfm.nr_cpf = pf.nr_cpf))
74. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.84..186.16 rows=37 width=19) (never executed)

75. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..169.65 rows=37 width=4) (never executed)

76. 0.000 0.000 ↓ 0.0 0

Seq Scan on filial f_1_1 (cost=0.00..1.37 rows=37 width=4) (never executed)

77. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = f_1_1.cd_pessoa_filial)
  • Heap Fetches: 0
78. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_juridica on pessoa_juridica pjm (cost=0.42..0.45 rows=1 width=19) (never executed)

  • Index Cond: (cd_pessoa = p_1_1.cd_pessoa)
  • Filter: (nr_cnpj IS NOT NULL)
79. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_fisica on pessoa_fisica pfm (cost=0.42..0.49 rows=1 width=16) (never executed)

  • Index Cond: (cd_pessoa = p_1_1.cd_pessoa)
  • Filter: (nr_cpf IS NOT NULL)
80. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_titulo_cd_movimento on titulo t (cost=0.43..3.67 rows=1 width=22) (never executed)

  • Index Cond: (cd_movimento = cfp.cd_movimento)
  • Filter: ((dt_quitacao >= '2020-06-01'::date) AND (dt_quitacao <= '2020-06-30'::date))
81. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_vw_carta_frete_comprovante on vw_carta_frete_comprovante vwcfc (cost=0.43..3.33 rows=1 width=70) (never executed)

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

Index Scan using pk_movimento on movimento m (cost=0.43..3.24 rows=1 width=10) (never executed)

  • Index Cond: (cd_movimento = cfp.cd_movimento)
83. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_titulo_debito on titulo_debito td (cost=0.43..4.54 rows=1 width=8) (never executed)

  • Index Cond: (cd_titulo = t.cd_titulo)
84. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_ctrc_complemento on ctrc_complemento cc (cost=0.29..8.30 rows=1 width=10) (never executed)

  • Index Cond: (cd_ctrc = ct.cd_ctrc)
85. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tipo_pagamento on tipo_pagamento tp (cost=0.27..2.43 rows=1 width=34) (never executed)

  • Index Cond: (cd_tipo_pagamento = td.cd_tipo_pagamento)
86. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = ct.cd_pessoa_transportadora)
87. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_veiculo on veiculo v (cost=0.42..8.44 rows=1 width=29) (never executed)

  • Index Cond: (cd_veiculo = ct.cd_veiculo)
88. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_ctrc_cte on ctrc_cte cte (cost=0.43..8.45 rows=1 width=8) (never executed)

  • Index Cond: (cd_ctrc = ct.cd_ctrc)
89. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_ctrc_produto on ctrc_produto cp (cost=8.95..16.97 rows=1 width=14) (never executed)

  • Index Cond: (cd_ctrc_produto = (SubPlan 12))
90.          

SubPlan (for Index Scan)

91. 0.000 0.000 ↓ 0.0 0

Limit (cost=8.52..8.52 rows=1 width=17) (never executed)

92. 0.000 0.000 ↓ 0.0 0

Sort (cost=8.52..8.52 rows=3 width=17) (never executed)

  • Sort Key: cp2.vl_peso DESC, cp2.vl_produto DESC, cp2.cd_ctrc_produto
93. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_ctrc_produto_cd_ctrc on ctrc_produto cp2 (cost=0.43..8.50 rows=3 width=17) (never executed)

  • Index Cond: (cd_ctrc = ct.cd_ctrc)
94. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_produto_venda on produto_transportado pt (cost=0.28..2.09 rows=1 width=27) (never executed)

  • Index Cond: (cd_produto = cp.cd_produto)
95. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = ct.cd_pessoa_motorista)
96. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_agencia on agencia ag (cost=0.14..8.16 rows=1 width=17) (never executed)

  • Index Cond: (cd_agencia = ct.cd_agencia)
97. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_carta_frete_diaria on carta_frete_diaria cfd (cost=0.29..3.04 rows=1 width=16) (never executed)

  • Index Cond: (cd_carta_frete_diaria = cfpa.cd_carta_frete_diaria)
98. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa pcf (cost=0.42..3.20 rows=1 width=33) (never executed)

  • Index Cond: (cd_pessoa = cfp.cd_pessoa)
99. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_cidade = pcf.cd_cidade)
100. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_uf = cpcf.cd_uf)
101. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tipo_veiculo on tipo_veiculo tv (cost=0.14..0.16 rows=1 width=20) (never executed)

  • Index Cond: (cd_tipo_veiculo = v.cd_tipo_veiculo)
102. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_veiculo_marca on veiculo_marca vm (cost=0.14..0.16 rows=1 width=11) (never executed)

  • Index Cond: (cd_marca = v.cd_marca)
103. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = CASE WHEN (cfpa.id_tipo = 5) THEN cfd.cd_pessoa_usuario ELSE ct.cd_pessoa_usuario END)
104. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_administradora_pagamento_eletronico on administradora_pagamento_eletronico adm (cost=0.14..0.15 rows=1 width=15) (never executed)

  • Index Cond: (cd_pessoa = cf.cd_pessoa_adm_pgto_eletronico)
105. 0.000 0.000 ↓ 0.0 0

CTE Scan on with_carta_frete_outros_descontos wcfod (cost=0.00..17.98 rows=899 width=36) (never executed)

106. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = ct.cd_pessoa_embarque)
  • Heap Fetches: 0
107. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = ct.cd_pessoa_entrega)
  • Heap Fetches: 0
108.          

SubPlan (for Nested Loop)

109. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_carta_frete_vale_pedagio_cd_ctrc on carta_frete_vale_pedagio cfvp (cost=0.42..8.45 rows=1 width=3) (never executed)

  • Index Cond: (cd_ctrc = cf.cd_ctrc)
  • Filter: (id_antecipado = '0'::smallint)
110. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_carta_frete_vale_pedagio_cd_ctrc on carta_frete_vale_pedagio cfvp_1 (cost=0.42..8.45 rows=1 width=3) (never executed)

  • Index Cond: (cd_ctrc = cf.cd_ctrc)
  • Filter: (id_antecipado = '1'::smallint)
111. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_carta_frete_vale_pedagio_cd_ctrc on carta_frete_vale_pedagio cfvp_2 (cost=0.42..8.45 rows=1 width=3) (never executed)

  • Index Cond: (cd_ctrc = cf.cd_ctrc)
  • Filter: (id_antecipado = '0'::smallint)
112. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_carta_frete_vale_pedagio_cd_ctrc on carta_frete_vale_pedagio cfvp_3 (cost=0.42..8.45 rows=1 width=3) (never executed)

  • Index Cond: (cd_ctrc = cf.cd_ctrc)
  • Filter: (id_antecipado = '1'::smallint)
113. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=8.45..8.46 rows=1 width=32) (never executed)

114. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_titulo on titulo (cost=0.43..8.45 rows=1 width=19) (never executed)

  • Index Cond: (cd_titulo = t.cd_titulo)
115. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_juridica on pessoa_juridica pjt (cost=0.42..8.44 rows=1 width=32) (never executed)

  • Index Cond: (cd_pessoa = ct.cd_pessoa_transportadora_doc)
116. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=12.76..12.77 rows=1 width=32) (never executed)

117. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.72..12.76 rows=1 width=6) (never executed)

118. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pk_carta_frete_parcelamento_documento_eletronico on carta_frete_parcelamento_documento_eletronico cfpde (cost=0.29..4.31 rows=1 width=4) (never executed)

  • Index Cond: ((cd_ctrc = cfpa.cd_ctrc) AND (id_tipo = cfpa.id_tipo) AND (nr_parcela = cfpa.nr_parcela))
  • Heap Fetches: 0
119. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_documento_eletronico on documento_eletronico de (cost=0.43..8.45 rows=1 width=10) (never executed)

  • Index Cond: (cd_documento_eletronico = cfpde.cd_documento_eletronico)
120. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=12.76..12.77 rows=1 width=32) (never executed)

121. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.72..12.76 rows=1 width=45) (never executed)

122. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pk_carta_frete_parcelamento_documento_eletronico on carta_frete_parcelamento_documento_eletronico cfpde_1 (cost=0.29..4.31 rows=1 width=4) (never executed)

  • Index Cond: ((cd_ctrc = cfpa.cd_ctrc) AND (id_tipo = cfpa.id_tipo) AND (nr_parcela = cfpa.nr_parcela))
  • Heap Fetches: 0
123. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_documento_eletronico on documento_eletronico de_1 (cost=0.43..8.45 rows=1 width=49) (never executed)

  • Index Cond: (cd_documento_eletronico = cfpde_1.cd_documento_eletronico)
124. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=26.97..26.98 rows=1 width=32) (never executed)

125. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.28..26.96 rows=1 width=8) (never executed)

126. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..26.47 rows=1 width=4) (never executed)

127. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_titulo_cd_movimento on titulo t_3 (cost=0.43..9.58 rows=2 width=4) (never executed)

  • Index Cond: (cd_movimento = cfp.cd_movimento)
128. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_titulo_debito on titulo_debito td_3 (cost=0.43..8.45 rows=1 width=8) (never executed)

  • Index Cond: (cd_titulo = t_3.cd_titulo)
129. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_cheque_emitido on cheque_emitido ch (cost=0.43..0.48 rows=1 width=12) (never executed)

  • Index Cond: (cd_cheque = td_3.cd_cheque)
  • Filter: (nr_cheque IS NOT NULL)
130. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa pe (cost=0.42..8.44 rows=1 width=25) (never executed)

  • Index Cond: (cd_pessoa = cfpa.cd_pessoa_usuario_liberacao)
131. 0.011 0.085 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2 (cost=4,236.50..4,304.83 rows=1 width=1,385) (actual time=0.085..0.085 rows=0 loops=1)

132. 0.002 0.074 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,236.50..4,304.81 rows=1 width=1,355) (actual time=0.074..0.074 rows=0 loops=1)

133. 0.001 0.072 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,236.07..4,288.02 rows=1 width=401) (actual time=0.072..0.072 rows=0 loops=1)

134. 0.001 0.071 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,235.93..4,287.86 rows=1 width=402) (actual time=0.071..0.071 rows=0 loops=1)

135. 0.001 0.070 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,235.65..4,287.56 rows=1 width=390) (actual time=0.070..0.070 rows=0 loops=1)

136. 0.001 0.069 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,235.38..4,287.27 rows=1 width=364) (actual time=0.069..0.069 rows=0 loops=1)

137. 0.001 0.068 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,235.24..4,287.11 rows=1 width=361) (actual time=0.068..0.068 rows=0 loops=1)

138. 0.001 0.067 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,235.10..4,286.95 rows=1 width=345) (actual time=0.067..0.067 rows=0 loops=1)

139. 0.002 0.066 ↓ 0.0 0 1

Nested Loop (cost=4,234.67..4,278.67 rows=1 width=324) (actual time=0.066..0.066 rows=0 loops=1)

140. 0.000 0.064 ↓ 0.0 0 1

Nested Loop (cost=4,234.25..4,274.70 rows=1 width=324) (actual time=0.064..0.064 rows=0 loops=1)

141. 0.001 0.064 ↓ 0.0 0 1

Nested Loop (cost=4,233.82..4,274.13 rows=1 width=314) (actual time=0.063..0.064 rows=0 loops=1)

142. 0.001 0.063 ↓ 0.0 0 1

Nested Loop (cost=4,233.39..4,265.68 rows=1 width=304) (actual time=0.062..0.063 rows=0 loops=1)

143. 0.001 0.062 ↓ 0.0 0 1

Nested Loop (cost=4,232.96..4,261.36 rows=1 width=308) (actual time=0.062..0.062 rows=0 loops=1)

144. 0.001 0.061 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,232.54..4,257.04 rows=1 width=312) (actual time=0.061..0.061 rows=0 loops=1)

145. 0.001 0.060 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,232.12..4,248.75 rows=1 width=279) (actual time=0.060..0.060 rows=0 loops=1)

146. 0.001 0.059 ↓ 0.0 0 1

Nested Loop (cost=4,231.70..4,240.47 rows=1 width=254) (actual time=0.059..0.059 rows=0 loops=1)

147. 0.001 0.058 ↓ 0.0 0 1

Nested Loop (cost=4,231.27..4,232.18 rows=1 width=229) (actual time=0.058..0.058 rows=0 loops=1)

148. 0.042 0.057 ↓ 0.0 0 1

Hash Join (cost=4,231.13..4,231.75 rows=1 width=216) (actual time=0.057..0.057 rows=0 loops=1)

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

Unique (cost=4,162.37..4,162.73 rows=18 width=126) (never executed)

150. 0.000 0.000 ↓ 0.0 0

Sort (cost=4,162.37..4,162.42 rows=18 width=126) (never executed)

  • Sort Key: (COALESCE(p_4.nm_fantasia, p_4.nm_pessoa)), p_4.cd_pessoa, p_4.cd_cidade, (((ci_1.nm_cidade || ' / '::text) || (uf_1.ds_sigla)::text)), ((COALESCE(pj_1.nr_cnpj, pf_1.nr_cpf))::character varying(14)), (COALESCE(substr((pj_1.nr_cnpj)::text, 1, 8), (pf_1.nr_cpf)::text)), (COALESCE((SubPlan 15), f_1.cd_pessoa_matriz))
151. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.91..4,162.00 rows=18 width=126) (never executed)

152. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.77..462.29 rows=18 width=90) (never executed)

153. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.49..456.88 rows=18 width=74) (never executed)

154. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=2.06..304.96 rows=18 width=35) (never executed)

  • Join Filter: (pg_1.cd_empresa = f_1.cd_pessoa_matriz)
155. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=2.06..302.68 rows=18 width=35) (never executed)

156. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.64..150.76 rows=18 width=23) (never executed)

157. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=1.22..2.82 rows=18 width=8) (never executed)

  • Hash Cond: (f_1.cd_pessoa_matriz = eg_2.cd_pessoa)
158. 0.000 0.000 ↓ 0.0 0

Seq Scan on filial f_1 (cost=0.00..1.46 rows=37 width=8) (never executed)

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

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

160. 0.000 0.000 ↓ 0.0 0

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

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

Index Scan using pk_pessoa_juridica on pessoa_juridica pj_1 (cost=0.42..8.22 rows=1 width=19) (never executed)

  • Index Cond: (cd_pessoa = f_1.cd_pessoa_filial)
  • Filter: (nr_cnpj IS NOT NULL)
162. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_fisica on pessoa_fisica pf_1 (cost=0.42..8.44 rows=1 width=16) (never executed)

  • Index Cond: (cd_pessoa = f_1.cd_pessoa_filial)
  • Filter: (nr_cpf IS NOT NULL)
163. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.00..2.01 rows=1 width=4) (never executed)

164. 0.000 0.000 ↓ 0.0 0

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

165. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = f_1.cd_pessoa_filial)
166. 0.000 0.000 ↓ 0.0 0

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

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

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

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

SubPlan (for Nested Loop)

169. 0.000 0.000 ↓ 0.0 0

Limit (cost=205.35..205.36 rows=1 width=4) (never executed)

170. 0.000 0.000 ↓ 0.0 0

Unique (cost=205.35..205.36 rows=1 width=4) (never executed)

171. 0.000 0.000 ↓ 0.0 0

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

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

Nested Loop Left Join (cost=1.26..205.34 rows=1 width=4) (never executed)

  • Filter: ((substr((pjm_1.nr_cnpj)::text, 1, 12) = (substr((pj_1.nr_cnpj)::text, 1, 8) || '0001'::text)) OR (pfm_1.nr_cpf = pf_1.nr_cpf))
173. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.84..186.16 rows=37 width=19) (never executed)

174. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..169.65 rows=37 width=4) (never executed)

175. 0.000 0.000 ↓ 0.0 0

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

176. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = f_1_2.cd_pessoa_filial)
  • Heap Fetches: 0
177. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_juridica on pessoa_juridica pjm_1 (cost=0.42..0.45 rows=1 width=19) (never executed)

  • Index Cond: (cd_pessoa = p_1_2.cd_pessoa)
  • Filter: (nr_cnpj IS NOT NULL)
178. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_fisica on pessoa_fisica pfm_1 (cost=0.42..0.49 rows=1 width=16) (never executed)

  • Index Cond: (cd_pessoa = p_1_2.cd_pessoa)
  • Filter: (nr_cpf IS NOT NULL)
179. 0.001 0.015 ↓ 0.0 0 1

Hash (cost=68.75..68.75 rows=1 width=184) (actual time=0.015..0.015 rows=0 loops=1)

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

Nested Loop Left Join (cost=52.32..68.75 rows=1 width=184) (actual time=0.013..0.014 rows=0 loops=1)

181. 0.001 0.012 ↓ 0.0 0 1

Nested Loop (cost=52.17..68.14 rows=1 width=156) (actual time=0.012..0.012 rows=0 loops=1)

182. 0.001 0.011 ↓ 0.0 0 1

Hash Join (cost=52.02..66.31 rows=3 width=138) (actual time=0.011..0.011 rows=0 loops=1)

  • Hash Cond: (cf_1.cd_pessoa_matriz = ve.cd_pessoa)
183. 0.010 0.010 ↓ 0.0 0 1

Seq Scan on contrato_frete cf_1 (cost=0.00..13.88 rows=103 width=106) (actual time=0.010..0.010 rows=0 loops=1)

  • Filter: (vl_adiantamento > '0'::numeric)
184. 0.000 0.000 ↓ 0.0 0

Hash (cost=51.94..51.94 rows=6 width=36) (never executed)

185. 0.000 0.000 ↓ 0.0 0

Subquery Scan on ve (cost=51.87..51.94 rows=6 width=36) (never executed)

186. 0.000 0.000 ↓ 0.0 0

Sort (cost=51.87..51.88 rows=6 width=36) (never executed)

  • Sort Key: (COALESCE(p_5.nm_fantasia, p_5.nm_pessoa))
187. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..51.79 rows=6 width=36) (never executed)

188. 0.000 0.000 ↓ 0.0 0

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

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

Index Scan using pk_pessoa on pessoa p_5 (cost=0.42..8.44 rows=1 width=39) (never executed)

  • Index Cond: (cd_pessoa = eg_3.cd_pessoa)
190. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contrato_frete_pagamento on contrato_frete_pagamento cfp_1 (cost=0.15..0.60 rows=1 width=26) (never executed)

  • Index Cond: ((cd_contrato = cf_1.cd_contrato) AND (id_tipo = 0))
191. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contrato_frete_parcelamento on contrato_frete_parcelamento cfpa_1 (cost=0.15..0.60 rows=1 width=32) (never executed)

  • Index Cond: ((cd_contrato = cf_1.cd_contrato) AND (id_tipo = 0))
192. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_agencia on agencia ag_1 (cost=0.14..0.43 rows=1 width=17) (never executed)

  • Index Cond: (cd_agencia = cf_1.cd_agencia)
193. 0.000 0.000 ↓ 0.0 0

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

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

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

  • Index Cond: (cd_pessoa = cf_1.cd_pessoa_motorista)
195. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa p_3 (cost=0.42..8.28 rows=1 width=33) (never executed)

  • Index Cond: (cd_pessoa = cf_1.cd_pessoa_transportadora)
196. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = cf_1.cd_pessoa_embarque)
  • Heap Fetches: 0
197. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = cf_1.cd_pessoa_entrega)
  • Heap Fetches: 0
198. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_movimento on movimento m_1 (cost=0.43..8.45 rows=1 width=10) (never executed)

  • Index Cond: (cd_movimento = cfp_1.cd_movimento)
199. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_titulo_cd_movimento on titulo t_1 (cost=0.43..0.56 rows=1 width=22) (never executed)

  • Index Cond: (cd_movimento = m_1.cd_movimento)
  • Filter: ((dt_quitacao >= '2020-06-01'::date) AND (dt_quitacao <= '2020-06-30'::date))
200. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_titulo_debito on titulo_debito td_1 (cost=0.43..3.97 rows=1 width=8) (never executed)

  • Index Cond: (cd_titulo = t_1.cd_titulo)
201. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_veiculo = cf_1.cd_veiculo)
202. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tipo_veiculo on tipo_veiculo tv_1 (cost=0.14..0.16 rows=1 width=20) (never executed)

  • Index Cond: (cd_tipo_veiculo = v_1.cd_tipo_veiculo)
203. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_veiculo_marca on veiculo_marca vm_1 (cost=0.14..0.16 rows=1 width=11) (never executed)

  • Index Cond: (cd_marca = v_1.cd_marca)
204. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tipo_pagamento on tipo_pagamento tp_1 (cost=0.27..0.29 rows=1 width=34) (never executed)

  • Index Cond: (cd_tipo_pagamento = td_1.cd_tipo_pagamento)
205. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_cidade = p_3.cd_cidade)
206. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_uf = c.cd_uf)
207. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa pd_1 (cost=0.42..8.28 rows=1 width=41) (never executed)

  • Index Cond: (cd_pessoa = cf_1.cd_pessoa_transportadora_doc)
208.          

SubPlan (for Nested Loop Left Join)

209. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_juridica on pessoa_juridica pjt_1 (cost=0.42..8.44 rows=1 width=32) (never executed)

  • Index Cond: (cd_pessoa = cf_1.cd_pessoa_transportadora_doc)
210. 0.001 0.061 ↓ 0.0 0 1

Subquery Scan on *SELECT* 3 (cost=4,236.50..4,304.82 rows=1 width=1,385) (actual time=0.061..0.061 rows=0 loops=1)

211. 0.001 0.060 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,236.50..4,304.80 rows=1 width=1,355) (actual time=0.059..0.060 rows=0 loops=1)

212. 0.017 0.059 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,236.07..4,288.02 rows=1 width=401) (actual time=0.059..0.059 rows=0 loops=1)

213. 0.007 0.042 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,235.93..4,287.86 rows=1 width=402) (actual time=0.042..0.042 rows=0 loops=1)

214. 0.001 0.035 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,235.65..4,287.56 rows=1 width=390) (actual time=0.035..0.035 rows=0 loops=1)

215. 0.006 0.034 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,235.38..4,287.27 rows=1 width=364) (actual time=0.034..0.034 rows=0 loops=1)

216. 0.001 0.028 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,235.24..4,287.11 rows=1 width=361) (actual time=0.028..0.028 rows=0 loops=1)

217. 0.001 0.027 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,235.10..4,286.95 rows=1 width=345) (actual time=0.027..0.027 rows=0 loops=1)

218. 0.000 0.026 ↓ 0.0 0 1

Nested Loop (cost=4,234.67..4,278.67 rows=1 width=324) (actual time=0.026..0.026 rows=0 loops=1)

219. 0.001 0.026 ↓ 0.0 0 1

Nested Loop (cost=4,234.25..4,274.70 rows=1 width=324) (actual time=0.025..0.026 rows=0 loops=1)

220. 0.001 0.025 ↓ 0.0 0 1

Nested Loop (cost=4,233.82..4,274.13 rows=1 width=314) (actual time=0.025..0.025 rows=0 loops=1)

221. 0.000 0.024 ↓ 0.0 0 1

Nested Loop (cost=4,233.39..4,265.68 rows=1 width=304) (actual time=0.024..0.024 rows=0 loops=1)

222. 0.001 0.024 ↓ 0.0 0 1

Nested Loop (cost=4,232.96..4,261.36 rows=1 width=308) (actual time=0.024..0.024 rows=0 loops=1)

223. 0.001 0.023 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,232.54..4,257.04 rows=1 width=312) (actual time=0.023..0.023 rows=0 loops=1)

224. 0.000 0.022 ↓ 0.0 0 1

Nested Loop Left Join (cost=4,232.12..4,248.75 rows=1 width=279) (actual time=0.022..0.022 rows=0 loops=1)

225. 0.001 0.022 ↓ 0.0 0 1

Nested Loop (cost=4,231.70..4,240.47 rows=1 width=254) (actual time=0.022..0.022 rows=0 loops=1)

226. 0.001 0.021 ↓ 0.0 0 1

Nested Loop (cost=4,231.27..4,232.18 rows=1 width=229) (actual time=0.021..0.021 rows=0 loops=1)

227. 0.014 0.020 ↓ 0.0 0 1

Hash Join (cost=4,231.13..4,231.75 rows=1 width=216) (actual time=0.020..0.020 rows=0 loops=1)

  • Hash Cond: (p_7.cd_pessoa = cf_2.cd_pessoa_filial)
228. 0.000 0.000 ↓ 0.0 0

Unique (cost=4,162.37..4,162.73 rows=18 width=126) (never executed)

229. 0.000 0.000 ↓ 0.0 0

Sort (cost=4,162.37..4,162.42 rows=18 width=126) (never executed)

  • Sort Key: (COALESCE(p_7.nm_fantasia, p_7.nm_pessoa)), p_7.cd_pessoa, p_7.cd_cidade, (((ci_2.nm_cidade || ' / '::text) || (uf_2.ds_sigla)::text)), ((COALESCE(pj_2.nr_cnpj, pf_2.nr_cpf))::character varying(14)), (COALESCE(substr((pj_2.nr_cnpj)::text, 1, 8), (pf_2.nr_cpf)::text)), (COALESCE((SubPlan 17), f_2.cd_pessoa_matriz))
230. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.91..4,162.00 rows=18 width=126) (never executed)

231. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.77..462.29 rows=18 width=90) (never executed)

232. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.49..456.88 rows=18 width=74) (never executed)

233. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=2.06..304.96 rows=18 width=35) (never executed)

  • Join Filter: (pg_2.cd_empresa = f_2.cd_pessoa_matriz)
234. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=2.06..302.68 rows=18 width=35) (never executed)

235. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.64..150.76 rows=18 width=23) (never executed)

236. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=1.22..2.82 rows=18 width=8) (never executed)

  • Hash Cond: (f_2.cd_pessoa_matriz = eg_4.cd_pessoa)
237. 0.000 0.000 ↓ 0.0 0

Seq Scan on filial f_2 (cost=0.00..1.46 rows=37 width=8) (never executed)

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

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

239. 0.000 0.000 ↓ 0.0 0

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

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

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

  • Index Cond: (cd_pessoa = f_2.cd_pessoa_filial)
  • Filter: (nr_cnpj IS NOT NULL)
241. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_fisica on pessoa_fisica pf_2 (cost=0.42..8.44 rows=1 width=16) (never executed)

  • Index Cond: (cd_pessoa = f_2.cd_pessoa_filial)
  • Filter: (nr_cpf IS NOT NULL)
242. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.00..2.01 rows=1 width=4) (never executed)

243. 0.000 0.000 ↓ 0.0 0

Seq Scan on parametro_geral pg_2 (cost=0.00..2.01 rows=1 width=4) (never executed)

244. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa p_7 (cost=0.42..8.44 rows=1 width=43) (never executed)

  • Index Cond: (cd_pessoa = f_2.cd_pessoa_filial)
245. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_cidade = p_7.cd_cidade)
246. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_uf = ci_2.cd_uf)
247.          

SubPlan (for Nested Loop)

248. 0.000 0.000 ↓ 0.0 0

Limit (cost=205.35..205.36 rows=1 width=4) (never executed)

249. 0.000 0.000 ↓ 0.0 0

Unique (cost=205.35..205.36 rows=1 width=4) (never executed)

250. 0.000 0.000 ↓ 0.0 0

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

  • Sort Key: p_1_3.cd_pessoa
251. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.26..205.34 rows=1 width=4) (never executed)

  • Filter: ((substr((pjm_2.nr_cnpj)::text, 1, 12) = (substr((pj_2.nr_cnpj)::text, 1, 8) || '0001'::text)) OR (pfm_2.nr_cpf = pf_2.nr_cpf))
252. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.84..186.16 rows=37 width=19) (never executed)

253. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..169.65 rows=37 width=4) (never executed)

254. 0.000 0.000 ↓ 0.0 0

Seq Scan on filial f_1_3 (cost=0.00..1.37 rows=37 width=4) (never executed)

255. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = f_1_3.cd_pessoa_filial)
  • Heap Fetches: 0
256. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_juridica on pessoa_juridica pjm_2 (cost=0.42..0.45 rows=1 width=19) (never executed)

  • Index Cond: (cd_pessoa = p_1_3.cd_pessoa)
  • Filter: (nr_cnpj IS NOT NULL)
257. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_fisica on pessoa_fisica pfm_2 (cost=0.42..0.49 rows=1 width=16) (never executed)

  • Index Cond: (cd_pessoa = p_1_3.cd_pessoa)
  • Filter: (nr_cpf IS NOT NULL)
258. 0.000 0.006 ↓ 0.0 0 1

Hash (cost=68.75..68.75 rows=1 width=184) (actual time=0.006..0.006 rows=0 loops=1)

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

Nested Loop Left Join (cost=52.32..68.75 rows=1 width=184) (actual time=0.005..0.006 rows=0 loops=1)

260. 0.001 0.005 ↓ 0.0 0 1

Nested Loop (cost=52.17..68.14 rows=1 width=156) (actual time=0.005..0.005 rows=0 loops=1)

261. 0.001 0.004 ↓ 0.0 0 1

Hash Join (cost=52.02..66.31 rows=3 width=138) (actual time=0.004..0.004 rows=0 loops=1)

  • Hash Cond: (cf_2.cd_pessoa_matriz = ve_1.cd_pessoa)
262. 0.003 0.003 ↓ 0.0 0 1

Seq Scan on contrato_frete cf_2 (cost=0.00..13.88 rows=103 width=106) (actual time=0.003..0.003 rows=0 loops=1)

  • Filter: (vl_saldo > '0'::numeric)
263. 0.000 0.000 ↓ 0.0 0

Hash (cost=51.94..51.94 rows=6 width=36) (never executed)

264. 0.000 0.000 ↓ 0.0 0

Subquery Scan on ve_1 (cost=51.87..51.94 rows=6 width=36) (never executed)

265. 0.000 0.000 ↓ 0.0 0

Sort (cost=51.87..51.88 rows=6 width=36) (never executed)

  • Sort Key: (COALESCE(p_8.nm_fantasia, p_8.nm_pessoa))
266. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.42..51.79 rows=6 width=36) (never executed)

267. 0.000 0.000 ↓ 0.0 0

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

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

Index Scan using pk_pessoa on pessoa p_8 (cost=0.42..8.44 rows=1 width=39) (never executed)

  • Index Cond: (cd_pessoa = eg_5.cd_pessoa)
269. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contrato_frete_pagamento on contrato_frete_pagamento cfp_2 (cost=0.15..0.60 rows=1 width=26) (never executed)

  • Index Cond: ((cd_contrato = cf_2.cd_contrato) AND (id_tipo = 1))
270. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_contrato_frete_parcelamento on contrato_frete_parcelamento cfpa_2 (cost=0.15..0.60 rows=1 width=32) (never executed)

  • Index Cond: ((cd_contrato = cf_2.cd_contrato) AND (id_tipo = 1))
271. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_agencia on agencia ag_2 (cost=0.14..0.43 rows=1 width=17) (never executed)

  • Index Cond: (cd_agencia = cf_2.cd_agencia)
272. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = cf_2.cd_pessoa_usuario)
273. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = cf_2.cd_pessoa_motorista)
274. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa p_6 (cost=0.42..8.28 rows=1 width=33) (never executed)

  • Index Cond: (cd_pessoa = cf_2.cd_pessoa_transportadora)
275. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = cf_2.cd_pessoa_embarque)
  • Heap Fetches: 0
276. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_pessoa = cf_2.cd_pessoa_entrega)
  • Heap Fetches: 0
277. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_movimento on movimento m_2 (cost=0.43..8.45 rows=1 width=10) (never executed)

  • Index Cond: (cd_movimento = cfp_2.cd_movimento)
278. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_titulo_cd_movimento on titulo t_2 (cost=0.43..0.56 rows=1 width=22) (never executed)

  • Index Cond: (cd_movimento = m_2.cd_movimento)
  • Filter: ((dt_quitacao >= '2020-06-01'::date) AND (dt_quitacao <= '2020-06-30'::date))
279. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_titulo_debito on titulo_debito td_2 (cost=0.43..3.97 rows=1 width=8) (never executed)

  • Index Cond: (cd_titulo = t_2.cd_titulo)
280. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_veiculo on veiculo v_2 (cost=0.42..8.28 rows=1 width=29) (never executed)

  • Index Cond: (cd_veiculo = cf_2.cd_veiculo)
281. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tipo_veiculo on tipo_veiculo tv_2 (cost=0.14..0.16 rows=1 width=20) (never executed)

  • Index Cond: (cd_tipo_veiculo = v_2.cd_tipo_veiculo)
282. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_veiculo_marca on veiculo_marca vm_2 (cost=0.14..0.16 rows=1 width=11) (never executed)

  • Index Cond: (cd_marca = v_2.cd_marca)
283. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tipo_pagamento on tipo_pagamento tp_2 (cost=0.27..0.29 rows=1 width=34) (never executed)

  • Index Cond: (cd_tipo_pagamento = td_2.cd_tipo_pagamento)
284. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_cidade = p_6.cd_cidade)
285. 0.000 0.000 ↓ 0.0 0

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

  • Index Cond: (cd_uf = c_1.cd_uf)
286. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa on pessoa pd_2 (cost=0.42..8.28 rows=1 width=41) (never executed)

  • Index Cond: (cd_pessoa = cf_2.cd_pessoa_transportadora_doc)
287.          

SubPlan (for Nested Loop Left Join)

288. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_pessoa_juridica on pessoa_juridica pjt_2 (cost=0.42..8.44 rows=1 width=32) (never executed)

  • Index Cond: (cd_pessoa = cf_2.cd_pessoa_transportadora_doc)
Planning time : 238.979 ms
Execution time : 1,135.981 ms