explain.depesz.com

PostgreSQL's explain analyze made readable

Result: h8XQ

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Sort (cost=1,700.07..1,700.42 rows=138 width=107) (actual rows= loops=)

  • Sort Key: tb_cntrt.id_contrato, tb_cntrt.nu_contrato
2. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1,669.26..1,695.17 rows=138 width=107) (actual rows= loops=)

  • Hash Cond: (tb_cntrt.id_contrato = cntrt.id_contrato)
3. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,660.35..1,681.40 rows=138 width=99) (actual rows= loops=)

  • Merge Cond: (tb_cntrt.id_contrato = tb_cntrt_9.id_contrato)
4. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,477.89..1,494.79 rows=138 width=91) (actual rows= loops=)

  • Merge Cond: (tb_cntrt.id_contrato = tb_cntrt_8.id_contrato)
5. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,308.02..1,320.79 rows=138 width=83) (actual rows= loops=)

  • Merge Cond: (tb_cntrt.id_contrato = tb_cntrt_7.id_contrato)
6. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,136.00..1,144.62 rows=138 width=75) (actual rows= loops=)

  • Merge Cond: (tb_cntrt.id_contrato = tb_cntrt_6.id_contrato)
7. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=912.01..916.50 rows=138 width=43) (actual rows= loops=)

  • Merge Cond: (tb_cntrt.id_contrato = tb_cntrt_2.id_contrato)
8. 0.000 0.000 ↓ 0.0

Sort (cost=98.62..98.97 rows=138 width=35) (actual rows= loops=)

  • Sort Key: tb_cntrt.id_contrato
9. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=91.62..93.72 rows=138 width=35) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_1.id_contrato = tb_cntrt.id_contrato)
10. 0.000 0.000 ↓ 0.0

Sort (cost=85.52..85.86 rows=138 width=28) (actual rows= loops=)

  • Sort Key: tb_cntrt_1.id_contrato, tb_cntrt_1.nu_contrato
11. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=73.18..80.61 rows=138 width=28) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_1.id_contrato = tot_af_inicio_faturamento.contrato)
12. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=41.58..47.05 rows=138 width=56) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_1.id_contrato = tot_autorizado_faturar_reaj.contrato)
13. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=26.51..31.42 rows=138 width=52) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_1.id_contrato = tot_autorizado_faturar.contrato)
14. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt tb_cntrt_1 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Hash (cost=26.48..26.48 rows=2 width=40) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_autorizado_faturar (cost=26.42..26.48 rows=2 width=40) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=26.42..26.46 rows=2 width=52) (actual rows= loops=)

  • Group Key: cntrt_1.id_contrato
18. 0.000 0.000 ↓ 0.0

Sort (cost=26.42..26.43 rows=2 width=27) (actual rows= loops=)

  • Sort Key: cntrt_1.id_contrato
19. 0.000 0.000 ↓ 0.0

Nested Loop (cost=13.94..26.41 rows=2 width=27) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Hash Join (cost=9.64..14.54 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_1.id_contrato = trzc.id_contrato)
21. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_1 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Hash (cost=9.62..9.62 rows=1 width=16) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc (cost=0.00..9.62 rows=1 width=16) (actual rows= loops=)

  • Filter: (in_situacao = 2)
24. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on tb_tm_trzc tmtrzc (cost=4.30..11.84 rows=3 width=15) (actual rows= loops=)

  • Recheck Cond: (id_autorizacao_faturamento = trzc.id_autorizacao_faturamento)
25. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on tb_tm_trzc_pkey (cost=0.00..4.30 rows=3 width=0) (actual rows= loops=)

  • Index Cond: (id_autorizacao_faturamento = trzc.id_autorizacao_faturamento)
26. 0.000 0.000 ↓ 0.0

Hash (cost=15.04..15.04 rows=3 width=12) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_autorizado_faturar_reaj (cost=14.96..15.04 rows=3 width=12) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=14.96..15.01 rows=3 width=24) (actual rows= loops=)

  • Group Key: cntrt_2.id_contrato
29. 0.000 0.000 ↓ 0.0

Sort (cost=14.96..14.97 rows=3 width=24) (actual rows= loops=)

  • Sort Key: cntrt_2.id_contrato
30. 0.000 0.000 ↓ 0.0

Hash Join (cost=9.66..14.93 rows=3 width=24) (actual rows= loops=)

  • Hash Cond: (cntrt_2.id_contrato = trzc_1.id_contrato)
31. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_2 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Hash (cost=9.62..9.62 rows=3 width=12) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_1 (cost=0.00..9.62 rows=3 width=12) (actual rows= loops=)

  • Filter: (in_situacao = ANY ('{1,2}'::integer[]))
34. 0.000 0.000 ↓ 0.0

Hash (cost=31.51..31.51 rows=7 width=40) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_af_inicio_faturamento (cost=31.30..31.51 rows=7 width=40) (actual rows= loops=)

36. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=31.30..31.44 rows=7 width=52) (actual rows= loops=)

  • Group Key: cntrt_3.id_contrato
37. 0.000 0.000 ↓ 0.0

Sort (cost=31.30..31.31 rows=7 width=34) (actual rows= loops=)

  • Sort Key: cntrt_3.id_contrato
38. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.78..31.20 rows=7 width=34) (actual rows= loops=)

  • Join Filter: (ftrmnt.id_autorizacao_faturamento = tmtrzc_1.id_autorizacao_faturamento)
39. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.51..29.45 rows=3 width=36) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Hash Join (cost=17.36..28.79 rows=3 width=24) (actual rows= loops=)

  • Hash Cond: (trzc_2.id_autorizacao_faturamento = ftrmnt.id_autorizacao_faturamento)
41. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_2 (cost=0.00..10.09 rows=350 width=16) (actual rows= loops=)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
42. 0.000 0.000 ↓ 0.0

Hash (cost=17.32..17.32 rows=3 width=8) (actual rows= loops=)

43. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt (cost=0.00..17.32 rows=3 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = 1)
44. 0.000 0.000 ↓ 0.0

Index Scan using tb_cntrt_id_contrato_idx on tb_cntrt cntrt_3 (cost=0.14..0.22 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id_contrato = trzc_2.id_contrato)
45. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_trzc_pkey on tb_tm_trzc tmtrzc_1 (cost=0.28..0.54 rows=3 width=22) (actual rows= loops=)

  • Index Cond: (id_autorizacao_faturamento = trzc_2.id_autorizacao_faturamento)
46. 0.000 0.000 ↓ 0.0

Hash (cost=4.38..4.38 rows=138 width=27) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt (cost=0.00..4.38 rows=138 width=27) (actual rows= loops=)

48. 0.000 0.000 ↓ 0.0

Materialize (cost=813.39..815.46 rows=138 width=16) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

Sort (cost=813.39..813.73 rows=138 width=28) (actual rows= loops=)

  • Sort Key: tb_cntrt_2.id_contrato, tb_cntrt_2.nu_contrato
50. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=788.77..808.48 rows=138 width=28) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_2.id_contrato = cntrt_4.id_contrato)
51. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=779.87..794.37 rows=138 width=124) (actual rows= loops=)

  • Merge Cond: (tb_cntrt_2.id_contrato = tb_cntrt_5.id_contrato)
52. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=597.40..607.76 rows=138 width=116) (actual rows= loops=)

  • Merge Cond: (tb_cntrt_2.id_contrato = tb_cntrt_4.id_contrato)
53. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=427.54..433.76 rows=138 width=108) (actual rows= loops=)

  • Merge Cond: (tb_cntrt_2.id_contrato = tb_cntrt_3.id_contrato)
54. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=255.52..257.59 rows=138 width=100) (actual rows= loops=)

  • Merge Cond: (tb_cntrt_2.id_contrato = cntrt_10.id_contrato)
55. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=240.96..242.65 rows=138 width=96) (actual rows= loops=)

  • Merge Cond: (tb_cntrt_2.id_contrato = cntrt_9.id_contrato)
56. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=214.54..215.79 rows=138 width=64) (actual rows= loops=)

  • Merge Cond: (tb_cntrt_2.id_contrato = a.contrato)
57. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=150.78..151.59 rows=138 width=56) (actual rows= loops=)

  • Merge Cond: (tb_cntrt_2.id_contrato = cntrt_6.id_contrato)
58. 0.000 0.000 ↓ 0.0

Sort (cost=117.93..118.28 rows=138 width=52) (actual rows= loops=)

  • Sort Key: tb_cntrt_2.id_contrato
59. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=108.17..113.03 rows=138 width=52) (actual rows= loops=)

  • Hash Cond: (cntrt_5.id_contrato = tb_cntrt_2.id_contrato)
60. 0.000 0.000 ↓ 0.0

HashAggregate (cost=102.06..105.17 rows=138 width=52) (actual rows= loops=)

  • Group Key: cntrt_5.id_contrato
61. 0.000 0.000 ↓ 0.0

Hash Join (cost=55.05..90.36 rows=1,170 width=40) (actual rows= loops=)

  • Hash Cond: (trzc_3.id_contrato = cntrt_5.id_contrato)
62. 0.000 0.000 ↓ 0.0

Hash Join (cost=48.95..81.10 rows=1,170 width=28) (actual rows= loops=)

  • Hash Cond: (ftrmnt_1.id_autorizacao_faturamento = trzc_3.id_autorizacao_faturamento)
63. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_1 (cost=0.00..17.96 rows=498 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento <> ALL ('{1,4,8}'::bigint[]))
64. 0.000 0.000 ↓ 0.0

Hash (cost=38.09..38.09 rows=869 width=44) (actual rows= loops=)

65. 0.000 0.000 ↓ 0.0

Hash Join (cost=14.46..38.09 rows=869 width=44) (actual rows= loops=)

  • Hash Cond: (tmtrzc_2.id_autorizacao_faturamento = trzc_3.id_autorizacao_faturamento)
66. 0.000 0.000 ↓ 0.0

Seq Scan on tb_tm_trzc tmtrzc_2 (cost=0.00..21.19 rows=919 width=28) (actual rows= loops=)

67. 0.000 0.000 ↓ 0.0

Hash (cost=10.09..10.09 rows=350 width=16) (actual rows= loops=)

68. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_3 (cost=0.00..10.09 rows=350 width=16) (actual rows= loops=)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
69. 0.000 0.000 ↓ 0.0

Hash (cost=4.38..4.38 rows=138 width=20) (actual rows= loops=)

70. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_5 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

71. 0.000 0.000 ↓ 0.0

Hash (cost=4.38..4.38 rows=138 width=20) (actual rows= loops=)

72. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt tb_cntrt_2 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

73. 0.000 0.000 ↓ 0.0

Materialize (cost=32.85..32.94 rows=3 width=12) (actual rows= loops=)

74. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=32.85..32.90 rows=3 width=24) (actual rows= loops=)

  • Group Key: cntrt_6.id_contrato
75. 0.000 0.000 ↓ 0.0

Sort (cost=32.85..32.85 rows=3 width=24) (actual rows= loops=)

  • Sort Key: cntrt_6.id_contrato
76. 0.000 0.000 ↓ 0.0

Hash Join (cost=27.55..32.82 rows=3 width=24) (actual rows= loops=)

  • Hash Cond: (cntrt_6.id_contrato = trzc_4.id_contrato)
77. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_6 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

78. 0.000 0.000 ↓ 0.0

Hash (cost=27.51..27.51 rows=3 width=12) (actual rows= loops=)

79. 0.000 0.000 ↓ 0.0

Hash Join (cost=10.11..27.51 rows=3 width=12) (actual rows= loops=)

  • Hash Cond: (ftrmnt_2.id_autorizacao_faturamento = trzc_4.id_autorizacao_faturamento)
80. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_2 (cost=0.00..16.06 rows=506 width=8) (actual rows= loops=)

81. 0.000 0.000 ↓ 0.0

Hash (cost=10.09..10.09 rows=2 width=20) (actual rows= loops=)

82. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_4 (cost=0.00..10.09 rows=2 width=20) (actual rows= loops=)

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
83. 0.000 0.000 ↓ 0.0

Materialize (cost=63.76..63.83 rows=2 width=16) (actual rows= loops=)

84. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=63.76..63.80 rows=2 width=194) (actual rows= loops=)

  • Group Key: a.contrato, a.numero_contrato
85. 0.000 0.000 ↓ 0.0

Sort (cost=63.76..63.77 rows=2 width=194) (actual rows= loops=)

  • Sort Key: a.contrato, a.numero_contrato
86. 0.000 0.000 ↓ 0.0

Subquery Scan on a (cost=63.71..63.75 rows=2 width=194) (actual rows= loops=)

87. 0.000 0.000 ↓ 0.0

Unique (cost=63.71..63.73 rows=2 width=202) (actual rows= loops=)

88. 0.000 0.000 ↓ 0.0

Sort (cost=63.71..63.71 rows=2 width=202) (actual rows= loops=)

  • Sort Key: "*SELECT* 1".id_faturamento, "*SELECT* 1".contrato, "*SELECT* 1".numero_contrato, (("*SELECT* 1".total_faturado_nf)::double precision)
89. 0.000 0.000 ↓ 0.0

Append (cost=34.22..63.70 rows=2 width=202) (actual rows= loops=)

90. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1 (cost=34.22..34.28 rows=1 width=36) (actual rows= loops=)

91. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=34.22..34.26 rows=1 width=60) (actual rows= loops=)

  • Group Key: ftrmnt_3.id_faturamento, cntrt_7.id_contrato
92. 0.000 0.000 ↓ 0.0

Sort (cost=34.22..34.22 rows=1 width=49) (actual rows= loops=)

  • Sort Key: ftrmnt_3.id_faturamento, cntrt_7.id_contrato
93. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=21.05..34.21 rows=1 width=49) (actual rows= loops=)

94. 0.000 0.000 ↓ 0.0

Nested Loop (cost=20.77..33.74 rows=1 width=43) (actual rows= loops=)

95. 0.000 0.000 ↓ 0.0

Hash Join (cost=20.50..25.41 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_7.id_contrato = ftrmnt_3.nu_processo_compra)
96. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_7 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

97. 0.000 0.000 ↓ 0.0

Hash (cost=20.49..20.49 rows=1 width=16) (actual rows= loops=)

98. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_3 (cost=0.00..20.49 rows=1 width=16) (actual rows= loops=)

  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento <> ALL ('{1,4,8}'::bigint[])) AND (cd_tipo_faturamento = ANY ('{1,2,3,4}'::bigint[])))
99. 0.000 0.000 ↓ 0.0

Index Scan using tb_dcmnt_fscl_pkey on tb_dcmnt_fscl dcmntfscl (cost=0.27..8.29 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (id_faturamento = ftrmnt_3.id_faturamento)
100. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_dcmnt_fscl_pkey on tb_tm_dcmnt_fscl ttdf (cost=0.27..0.44 rows=3 width=22) (actual rows= loops=)

  • Index Cond: (id_faturamento = dcmntfscl.id_faturamento)
101. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=36) (actual rows= loops=)

  • Group Key: ftrmnt_4.id_faturamento, cntrt_8.id_contrato
102. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=36) (actual rows= loops=)

  • Sort Key: ftrmnt_4.id_faturamento, cntrt_8.id_contrato
103. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=36) (actual rows= loops=)

  • Hash Cond: (cntrt_8.id_contrato = ftrmnt_4.nu_processo_compra)
104. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_8 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

105. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=24) (actual rows= loops=)

106. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=24) (actual rows= loops=)

107. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_ltrnc_v2_0_pkey on tb_splh_nf_ltrnc_v2_0 splh (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

108. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_4 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (cd_tipo_faturamento = ANY ('{2,1}'::bigint[])) AND (in_situacao_faturamento <> ALL ('{1,4,8}'::bigint[])))
109. 0.000 0.000 ↓ 0.0

Materialize (cost=26.42..26.49 rows=2 width=40) (actual rows= loops=)

110. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=26.42..26.46 rows=2 width=52) (actual rows= loops=)

  • Group Key: cntrt_9.id_contrato
111. 0.000 0.000 ↓ 0.0

Sort (cost=26.42..26.43 rows=2 width=27) (actual rows= loops=)

  • Sort Key: cntrt_9.id_contrato
112. 0.000 0.000 ↓ 0.0

Nested Loop (cost=13.94..26.41 rows=2 width=27) (actual rows= loops=)

113. 0.000 0.000 ↓ 0.0

Hash Join (cost=9.64..14.54 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_9.id_contrato = trzc_5.id_contrato)
114. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_9 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

115. 0.000 0.000 ↓ 0.0

Hash (cost=9.62..9.62 rows=1 width=16) (actual rows= loops=)

116. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_5 (cost=0.00..9.62 rows=1 width=16) (actual rows= loops=)

  • Filter: (in_situacao = 4)
117. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on tb_tm_trzc tmtrzc_3 (cost=4.30..11.84 rows=3 width=15) (actual rows= loops=)

  • Recheck Cond: (id_autorizacao_faturamento = trzc_5.id_autorizacao_faturamento)
118. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on tb_tm_trzc_pkey (cost=0.00..4.30 rows=3 width=0) (actual rows= loops=)

  • Index Cond: (id_autorizacao_faturamento = trzc_5.id_autorizacao_faturamento)
119. 0.000 0.000 ↓ 0.0

Materialize (cost=14.55..14.59 rows=1 width=12) (actual rows= loops=)

120. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=14.55..14.57 rows=1 width=24) (actual rows= loops=)

  • Group Key: cntrt_10.id_contrato
121. 0.000 0.000 ↓ 0.0

Sort (cost=14.55..14.56 rows=1 width=24) (actual rows= loops=)

  • Sort Key: cntrt_10.id_contrato
122. 0.000 0.000 ↓ 0.0

Hash Join (cost=9.64..14.54 rows=1 width=24) (actual rows= loops=)

  • Hash Cond: (cntrt_10.id_contrato = trzc_6.id_contrato)
123. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_10 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

124. 0.000 0.000 ↓ 0.0

Hash (cost=9.62..9.62 rows=1 width=12) (actual rows= loops=)

125. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_6 (cost=0.00..9.62 rows=1 width=12) (actual rows= loops=)

  • Filter: (in_situacao = 4)
126. 0.000 0.000 ↓ 0.0

Materialize (cost=172.03..174.10 rows=138 width=16) (actual rows= loops=)

127. 0.000 0.000 ↓ 0.0

Sort (cost=172.03..172.37 rows=138 width=28) (actual rows= loops=)

  • Sort Key: tb_cntrt_3.id_contrato, tb_cntrt_3.nu_contrato
128. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=159.13..167.12 rows=138 width=28) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_3.id_contrato = tot_recebido_sem_af_nfe.contrato)
129. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=95.92..101.99 rows=138 width=64) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_3.id_contrato = tot_recebido_sem_af_nf.contrato)
130. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=66.49..72.03 rows=138 width=56) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_3.id_contrato = tot_recebido_af.contrato)
131. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=32.73..37.64 rows=138 width=24) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_3.id_contrato = tot_faturado_af_reaj.contrato)
132. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt tb_cntrt_3 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

133. 0.000 0.000 ↓ 0.0

Hash (cost=32.72..32.72 rows=1 width=12) (actual rows= loops=)

134. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_faturado_af_reaj (cost=32.69..32.72 rows=1 width=12) (actual rows= loops=)

135. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=32.69..32.71 rows=1 width=24) (actual rows= loops=)

  • Group Key: cntrt_11.id_contrato
136. 0.000 0.000 ↓ 0.0

Sort (cost=32.69..32.70 rows=1 width=24) (actual rows= loops=)

  • Sort Key: cntrt_11.id_contrato
137. 0.000 0.000 ↓ 0.0

Nested Loop (cost=10.11..32.68 rows=1 width=24) (actual rows= loops=)

  • Join Filter: (trzc_7.id_autorizacao_faturamento = ftrmnt_5.id_autorizacao_faturamento)
138. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_5 (cost=0.00..17.32 rows=5 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = ANY ('{9,21}'::bigint[]))
139. 0.000 0.000 ↓ 0.0

Materialize (cost=10.11..15.21 rows=2 width=32) (actual rows= loops=)

140. 0.000 0.000 ↓ 0.0

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual rows= loops=)

  • Hash Cond: (cntrt_11.id_contrato = trzc_7.id_contrato)
141. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_11 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

142. 0.000 0.000 ↓ 0.0

Hash (cost=10.09..10.09 rows=2 width=20) (actual rows= loops=)

143. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_7 (cost=0.00..10.09 rows=2 width=20) (actual rows= loops=)

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
144. 0.000 0.000 ↓ 0.0

Hash (cost=33.60..33.60 rows=12 width=40) (actual rows= loops=)

145. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_af (cost=33.06..33.60 rows=12 width=40) (actual rows= loops=)

146. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=33.06..33.48 rows=12 width=52) (actual rows= loops=)

  • Group Key: cntrt_12.id_contrato
147. 0.000 0.000 ↓ 0.0

Sort (cost=33.06..33.09 rows=12 width=40) (actual rows= loops=)

  • Sort Key: cntrt_12.id_contrato
148. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.81..32.85 rows=12 width=40) (actual rows= loops=)

  • Join Filter: (ftrmnt_6.id_autorizacao_faturamento = tmtrzc_4.id_autorizacao_faturamento)
149. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.53..29.94 rows=5 width=36) (actual rows= loops=)

150. 0.000 0.000 ↓ 0.0

Hash Join (cost=17.39..28.84 rows=5 width=24) (actual rows= loops=)

  • Hash Cond: (trzc_8.id_autorizacao_faturamento = ftrmnt_6.id_autorizacao_faturamento)
151. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_8 (cost=0.00..10.09 rows=350 width=16) (actual rows= loops=)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
152. 0.000 0.000 ↓ 0.0

Hash (cost=17.32..17.32 rows=5 width=8) (actual rows= loops=)

153. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_6 (cost=0.00..17.32 rows=5 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = ANY ('{9,21}'::bigint[]))
154. 0.000 0.000 ↓ 0.0

Index Scan using tb_cntrt_id_contrato_idx on tb_cntrt cntrt_12 (cost=0.14..0.22 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id_contrato = trzc_8.id_contrato)
155. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_trzc_pkey on tb_tm_trzc tmtrzc_4 (cost=0.28..0.54 rows=3 width=28) (actual rows= loops=)

  • Index Cond: (id_autorizacao_faturamento = trzc_8.id_autorizacao_faturamento)
156. 0.000 0.000 ↓ 0.0

Hash (cost=29.42..29.42 rows=1 width=16) (actual rows= loops=)

157. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nf (cost=29.39..29.42 rows=1 width=16) (actual rows= loops=)

158. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=28) (actual rows= loops=)

  • Group Key: cntrt_13.id_contrato
159. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=28) (actual rows= loops=)

  • Sort Key: cntrt_13.id_contrato
160. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_13.id_contrato = ftrmnt_7.nu_processo_compra)
161. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_13 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

162. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=16) (actual rows= loops=)

163. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=16) (actual rows= loops=)

164. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_fsc_pkey on tb_splh_nf_fsc splh_1 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

165. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_7 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_1.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{9,21}'::bigint[])) AND (cd_tipo_faturamento = 3))
166. 0.000 0.000 ↓ 0.0

Hash (cost=63.19..63.19 rows=2 width=16) (actual rows= loops=)

167. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nfe (cost=63.13..63.19 rows=2 width=16) (actual rows= loops=)

168. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=63.13..63.17 rows=2 width=194) (actual rows= loops=)

  • Group Key: a_1.contrato, a_1.numero_contrato
169. 0.000 0.000 ↓ 0.0

Sort (cost=63.13..63.13 rows=2 width=194) (actual rows= loops=)

  • Sort Key: a_1.contrato, a_1.numero_contrato
170. 0.000 0.000 ↓ 0.0

Subquery Scan on a_1 (cost=63.07..63.12 rows=2 width=194) (actual rows= loops=)

171. 0.000 0.000 ↓ 0.0

Unique (cost=63.07..63.10 rows=2 width=202) (actual rows= loops=)

172. 0.000 0.000 ↓ 0.0

Sort (cost=63.07..63.08 rows=2 width=202) (actual rows= loops=)

  • Sort Key: "*SELECT* 1_1".id_faturamento, "*SELECT* 1_1".contrato, "*SELECT* 1_1".numero_contrato, (("*SELECT* 1_1".total_recebido_nf)::double precision)
173. 0.000 0.000 ↓ 0.0

Append (cost=33.59..63.06 rows=2 width=202) (actual rows= loops=)

174. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1_1 (cost=33.59..33.64 rows=1 width=36) (actual rows= loops=)

175. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=33.59..33.63 rows=1 width=60) (actual rows= loops=)

  • Group Key: ftrmnt_8.id_faturamento, cntrt_14.id_contrato
176. 0.000 0.000 ↓ 0.0

Sort (cost=33.59..33.59 rows=1 width=49) (actual rows= loops=)

  • Sort Key: ftrmnt_8.id_faturamento, cntrt_14.id_contrato
177. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=20.41..33.58 rows=1 width=49) (actual rows= loops=)

178. 0.000 0.000 ↓ 0.0

Nested Loop (cost=20.14..33.10 rows=1 width=43) (actual rows= loops=)

179. 0.000 0.000 ↓ 0.0

Hash Join (cost=19.87..24.77 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_14.id_contrato = ftrmnt_8.nu_processo_compra)
180. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_14 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

181. 0.000 0.000 ↓ 0.0

Hash (cost=19.86..19.86 rows=1 width=16) (actual rows= loops=)

182. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_8 (cost=0.00..19.86 rows=1 width=16) (actual rows= loops=)

  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{9,21}'::bigint[])) AND (cd_tipo_faturamento = ANY ('{1,2,3,4}'::bigint[])))
183. 0.000 0.000 ↓ 0.0

Index Scan using tb_dcmnt_fscl_pkey on tb_dcmnt_fscl dcmntfscl_1 (cost=0.27..8.29 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (id_faturamento = ftrmnt_8.id_faturamento)
184. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_dcmnt_fscl_pkey on tb_tm_dcmnt_fscl ttdf_1 (cost=0.27..0.44 rows=3 width=22) (actual rows= loops=)

  • Index Cond: (id_faturamento = dcmntfscl_1.id_faturamento)
185. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=36) (actual rows= loops=)

  • Group Key: ftrmnt_9.id_faturamento, cntrt_15.id_contrato
186. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=36) (actual rows= loops=)

  • Sort Key: ftrmnt_9.id_faturamento, cntrt_15.id_contrato
187. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=36) (actual rows= loops=)

  • Hash Cond: (cntrt_15.id_contrato = ftrmnt_9.nu_processo_compra)
188. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_15 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

189. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=24) (actual rows= loops=)

190. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=24) (actual rows= loops=)

191. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_ltrnc_v2_0_pkey on tb_splh_nf_ltrnc_v2_0 splh_2 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

192. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_9 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_2.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (cd_tipo_faturamento = ANY ('{2,1}'::bigint[])) AND (in_situacao_faturamento = ANY ('{9,21}'::bigint[])))
193. 0.000 0.000 ↓ 0.0

Materialize (cost=169.86..171.93 rows=138 width=16) (actual rows= loops=)

194. 0.000 0.000 ↓ 0.0

Sort (cost=169.86..170.21 rows=138 width=28) (actual rows= loops=)

  • Sort Key: tb_cntrt_4.id_contrato, tb_cntrt_4.nu_contrato
195. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=157.02..164.96 rows=138 width=28) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_4.id_contrato = tot_recebido_sem_af_nfe_1.contrato)
196. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=93.80..99.83 rows=138 width=64) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_4.id_contrato = tot_recebido_sem_af_nf_1.contrato)
197. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=64.37..69.87 rows=138 width=56) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_4.id_contrato = tot_faturado_af_reaj_1.contrato)
198. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=31.70..36.67 rows=138 width=52) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_4.id_contrato = tot_recebido_af_1.contrato)
199. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt tb_cntrt_4 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

200. 0.000 0.000 ↓ 0.0

Hash (cost=31.61..31.61 rows=7 width=40) (actual rows= loops=)

201. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_af_1 (cost=31.30..31.61 rows=7 width=40) (actual rows= loops=)

202. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=31.30..31.54 rows=7 width=52) (actual rows= loops=)

  • Group Key: cntrt_16.id_contrato
203. 0.000 0.000 ↓ 0.0

Sort (cost=31.30..31.31 rows=7 width=40) (actual rows= loops=)

  • Sort Key: cntrt_16.id_contrato
204. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.78..31.20 rows=7 width=40) (actual rows= loops=)

  • Join Filter: (ftrmnt_10.id_autorizacao_faturamento = tmtrzc_5.id_autorizacao_faturamento)
205. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.51..29.45 rows=3 width=36) (actual rows= loops=)

206. 0.000 0.000 ↓ 0.0

Hash Join (cost=17.36..28.79 rows=3 width=24) (actual rows= loops=)

  • Hash Cond: (trzc_9.id_autorizacao_faturamento = ftrmnt_10.id_autorizacao_faturamento)
207. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_9 (cost=0.00..10.09 rows=350 width=16) (actual rows= loops=)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
208. 0.000 0.000 ↓ 0.0

Hash (cost=17.32..17.32 rows=3 width=8) (actual rows= loops=)

209. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_10 (cost=0.00..17.32 rows=3 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = 22)
210. 0.000 0.000 ↓ 0.0

Index Scan using tb_cntrt_id_contrato_idx on tb_cntrt cntrt_16 (cost=0.14..0.22 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id_contrato = trzc_9.id_contrato)
211. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_trzc_pkey on tb_tm_trzc tmtrzc_5 (cost=0.28..0.54 rows=3 width=28) (actual rows= loops=)

  • Index Cond: (id_autorizacao_faturamento = trzc_9.id_autorizacao_faturamento)
212. 0.000 0.000 ↓ 0.0

Hash (cost=32.66..32.66 rows=1 width=12) (actual rows= loops=)

213. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_faturado_af_reaj_1 (cost=32.63..32.66 rows=1 width=12) (actual rows= loops=)

214. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=32.63..32.65 rows=1 width=24) (actual rows= loops=)

  • Group Key: cntrt_17.id_contrato
215. 0.000 0.000 ↓ 0.0

Sort (cost=32.63..32.64 rows=1 width=24) (actual rows= loops=)

  • Sort Key: cntrt_17.id_contrato
216. 0.000 0.000 ↓ 0.0

Nested Loop (cost=10.11..32.62 rows=1 width=24) (actual rows= loops=)

  • Join Filter: (trzc_10.id_autorizacao_faturamento = ftrmnt_11.id_autorizacao_faturamento)
217. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_11 (cost=0.00..17.32 rows=3 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = 22)
218. 0.000 0.000 ↓ 0.0

Materialize (cost=10.11..15.21 rows=2 width=32) (actual rows= loops=)

219. 0.000 0.000 ↓ 0.0

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual rows= loops=)

  • Hash Cond: (cntrt_17.id_contrato = trzc_10.id_contrato)
220. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_17 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

221. 0.000 0.000 ↓ 0.0

Hash (cost=10.09..10.09 rows=2 width=20) (actual rows= loops=)

222. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_10 (cost=0.00..10.09 rows=2 width=20) (actual rows= loops=)

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
223. 0.000 0.000 ↓ 0.0

Hash (cost=29.42..29.42 rows=1 width=16) (actual rows= loops=)

224. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nf_1 (cost=29.39..29.42 rows=1 width=16) (actual rows= loops=)

225. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=28) (actual rows= loops=)

  • Group Key: cntrt_18.id_contrato
226. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=28) (actual rows= loops=)

  • Sort Key: cntrt_18.id_contrato
227. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_18.id_contrato = ftrmnt_12.nu_processo_compra)
228. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_18 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

229. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=16) (actual rows= loops=)

230. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=16) (actual rows= loops=)

231. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_fsc_pkey on tb_splh_nf_fsc splh_3 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

232. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_12 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_3.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (cd_tipo_faturamento = 3) AND (in_situacao_faturamento = 22))
233. 0.000 0.000 ↓ 0.0

Hash (cost=63.19..63.19 rows=2 width=16) (actual rows= loops=)

234. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nfe_1 (cost=63.13..63.19 rows=2 width=16) (actual rows= loops=)

235. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=63.13..63.17 rows=2 width=194) (actual rows= loops=)

  • Group Key: a_2.contrato, a_2.numero_contrato
236. 0.000 0.000 ↓ 0.0

Sort (cost=63.13..63.13 rows=2 width=194) (actual rows= loops=)

  • Sort Key: a_2.contrato, a_2.numero_contrato
237. 0.000 0.000 ↓ 0.0

Subquery Scan on a_2 (cost=63.07..63.12 rows=2 width=194) (actual rows= loops=)

238. 0.000 0.000 ↓ 0.0

Unique (cost=63.07..63.10 rows=2 width=202) (actual rows= loops=)

239. 0.000 0.000 ↓ 0.0

Sort (cost=63.07..63.08 rows=2 width=202) (actual rows= loops=)

  • Sort Key: "*SELECT* 1_2".id_faturamento, "*SELECT* 1_2".contrato, "*SELECT* 1_2".numero_contrato, (("*SELECT* 1_2".total_recebido_nf)::double precision)
240. 0.000 0.000 ↓ 0.0

Append (cost=33.59..63.06 rows=2 width=202) (actual rows= loops=)

241. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1_2 (cost=33.59..33.64 rows=1 width=36) (actual rows= loops=)

242. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=33.59..33.63 rows=1 width=60) (actual rows= loops=)

  • Group Key: ftrmnt_13.id_faturamento, cntrt_19.id_contrato
243. 0.000 0.000 ↓ 0.0

Sort (cost=33.59..33.59 rows=1 width=49) (actual rows= loops=)

  • Sort Key: ftrmnt_13.id_faturamento, cntrt_19.id_contrato
244. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=20.41..33.58 rows=1 width=49) (actual rows= loops=)

245. 0.000 0.000 ↓ 0.0

Nested Loop (cost=20.14..33.10 rows=1 width=43) (actual rows= loops=)

246. 0.000 0.000 ↓ 0.0

Hash Join (cost=19.87..24.77 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_19.id_contrato = ftrmnt_13.nu_processo_compra)
247. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_19 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

248. 0.000 0.000 ↓ 0.0

Hash (cost=19.86..19.86 rows=1 width=16) (actual rows= loops=)

249. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_13 (cost=0.00..19.86 rows=1 width=16) (actual rows= loops=)

  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = 22) AND (cd_tipo_faturamento = ANY ('{1,2,3,4}'::bigint[])))
250. 0.000 0.000 ↓ 0.0

Index Scan using tb_dcmnt_fscl_pkey on tb_dcmnt_fscl dcmntfscl_2 (cost=0.27..8.29 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (id_faturamento = ftrmnt_13.id_faturamento)
251. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_dcmnt_fscl_pkey on tb_tm_dcmnt_fscl ttdf_2 (cost=0.27..0.44 rows=3 width=22) (actual rows= loops=)

  • Index Cond: (id_faturamento = dcmntfscl_2.id_faturamento)
252. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=36) (actual rows= loops=)

  • Group Key: ftrmnt_14.id_faturamento, cntrt_20.id_contrato
253. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=36) (actual rows= loops=)

  • Sort Key: ftrmnt_14.id_faturamento, cntrt_20.id_contrato
254. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=36) (actual rows= loops=)

  • Hash Cond: (cntrt_20.id_contrato = ftrmnt_14.nu_processo_compra)
255. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_20 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

256. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=24) (actual rows= loops=)

257. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=24) (actual rows= loops=)

258. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_ltrnc_v2_0_pkey on tb_splh_nf_ltrnc_v2_0 splh_4 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

259. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_14 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_4.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (cd_tipo_faturamento = ANY ('{2,1}'::bigint[])) AND (in_situacao_faturamento = 22))
260. 0.000 0.000 ↓ 0.0

Materialize (cost=182.47..184.54 rows=138 width=16) (actual rows= loops=)

261. 0.000 0.000 ↓ 0.0

Sort (cost=182.47..182.81 rows=138 width=28) (actual rows= loops=)

  • Sort Key: tb_cntrt_5.id_contrato, tb_cntrt_5.nu_contrato
262. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=168.26..177.56 rows=138 width=28) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_5.id_contrato = tot_recebido_sem_af_nfe_2.contrato)
263. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=105.05..111.74 rows=138 width=67) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_5.id_contrato = tot_recebido_sem_af_nf_2.contrato)
264. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=75.62..81.78 rows=138 width=59) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_5.id_contrato = tot_recebido_af_2.contrato)
265. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=41.86..47.39 rows=138 width=27) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_5.id_contrato = tot_faturado_af_reaj_2.contrato)
266. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=9.13..14.13 rows=138 width=23) (actual rows= loops=)

  • Hash Cond: (cntrt_21.id_contrato = tb_cntrt_5.id_contrato)
267. 0.000 0.000 ↓ 0.0

Hash Join (cost=3.02..7.78 rows=90 width=11) (actual rows= loops=)

  • Hash Cond: (cntrt_21.id_contrato = pre_2.id_contrato)
268. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_21 (cost=0.00..4.38 rows=138 width=8) (actual rows= loops=)

269. 0.000 0.000 ↓ 0.0

Hash (cost=1.90..1.90 rows=90 width=11) (actual rows= loops=)

270. 0.000 0.000 ↓ 0.0

Seq Scan on tb_vl_tlzd_pr_vtr pre_2 (cost=0.00..1.90 rows=90 width=11) (actual rows= loops=)

271. 0.000 0.000 ↓ 0.0

Hash (cost=4.38..4.38 rows=138 width=20) (actual rows= loops=)

272. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt tb_cntrt_5 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

273. 0.000 0.000 ↓ 0.0

Hash (cost=32.72..32.72 rows=1 width=12) (actual rows= loops=)

274. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_faturado_af_reaj_2 (cost=32.69..32.72 rows=1 width=12) (actual rows= loops=)

275. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=32.69..32.71 rows=1 width=24) (actual rows= loops=)

  • Group Key: cntrt_22.id_contrato
276. 0.000 0.000 ↓ 0.0

Sort (cost=32.69..32.70 rows=1 width=24) (actual rows= loops=)

  • Sort Key: cntrt_22.id_contrato
277. 0.000 0.000 ↓ 0.0

Nested Loop (cost=10.11..32.68 rows=1 width=24) (actual rows= loops=)

  • Join Filter: (trzc_11.id_autorizacao_faturamento = ftrmnt_15.id_autorizacao_faturamento)
278. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_15 (cost=0.00..17.32 rows=5 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = ANY ('{12,13}'::bigint[]))
279. 0.000 0.000 ↓ 0.0

Materialize (cost=10.11..15.21 rows=2 width=32) (actual rows= loops=)

280. 0.000 0.000 ↓ 0.0

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual rows= loops=)

  • Hash Cond: (cntrt_22.id_contrato = trzc_11.id_contrato)
281. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_22 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

282. 0.000 0.000 ↓ 0.0

Hash (cost=10.09..10.09 rows=2 width=20) (actual rows= loops=)

283. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_11 (cost=0.00..10.09 rows=2 width=20) (actual rows= loops=)

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
284. 0.000 0.000 ↓ 0.0

Hash (cost=33.60..33.60 rows=12 width=40) (actual rows= loops=)

285. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_af_2 (cost=33.06..33.60 rows=12 width=40) (actual rows= loops=)

286. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=33.06..33.48 rows=12 width=52) (actual rows= loops=)

  • Group Key: cntrt_23.id_contrato
287. 0.000 0.000 ↓ 0.0

Sort (cost=33.06..33.09 rows=12 width=40) (actual rows= loops=)

  • Sort Key: cntrt_23.id_contrato
288. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.81..32.85 rows=12 width=40) (actual rows= loops=)

  • Join Filter: (ftrmnt_16.id_autorizacao_faturamento = tmtrzc_6.id_autorizacao_faturamento)
289. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.53..29.94 rows=5 width=36) (actual rows= loops=)

290. 0.000 0.000 ↓ 0.0

Hash Join (cost=17.39..28.84 rows=5 width=24) (actual rows= loops=)

  • Hash Cond: (trzc_12.id_autorizacao_faturamento = ftrmnt_16.id_autorizacao_faturamento)
291. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_12 (cost=0.00..10.09 rows=350 width=16) (actual rows= loops=)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
292. 0.000 0.000 ↓ 0.0

Hash (cost=17.32..17.32 rows=5 width=8) (actual rows= loops=)

293. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_16 (cost=0.00..17.32 rows=5 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = ANY ('{12,13}'::bigint[]))
294. 0.000 0.000 ↓ 0.0

Index Scan using tb_cntrt_id_contrato_idx on tb_cntrt cntrt_23 (cost=0.14..0.22 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id_contrato = trzc_12.id_contrato)
295. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_trzc_pkey on tb_tm_trzc tmtrzc_6 (cost=0.28..0.54 rows=3 width=28) (actual rows= loops=)

  • Index Cond: (id_autorizacao_faturamento = trzc_12.id_autorizacao_faturamento)
296. 0.000 0.000 ↓ 0.0

Hash (cost=29.42..29.42 rows=1 width=16) (actual rows= loops=)

297. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nf_2 (cost=29.39..29.42 rows=1 width=16) (actual rows= loops=)

298. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=28) (actual rows= loops=)

  • Group Key: cntrt_24.id_contrato
299. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=28) (actual rows= loops=)

  • Sort Key: cntrt_24.id_contrato
300. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_24.id_contrato = ftrmnt_17.nu_processo_compra)
301. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_24 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

302. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=16) (actual rows= loops=)

303. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=16) (actual rows= loops=)

304. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_fsc_pkey on tb_splh_nf_fsc splh_5 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

305. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_17 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_5.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{12,13}'::bigint[])) AND (cd_tipo_faturamento = 3))
306. 0.000 0.000 ↓ 0.0

Hash (cost=63.19..63.19 rows=2 width=16) (actual rows= loops=)

307. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nfe_2 (cost=63.13..63.19 rows=2 width=16) (actual rows= loops=)

308. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=63.13..63.17 rows=2 width=194) (actual rows= loops=)

  • Group Key: a_3.contrato, a_3.numero_contrato
309. 0.000 0.000 ↓ 0.0

Sort (cost=63.13..63.13 rows=2 width=194) (actual rows= loops=)

  • Sort Key: a_3.contrato, a_3.numero_contrato
310. 0.000 0.000 ↓ 0.0

Subquery Scan on a_3 (cost=63.07..63.12 rows=2 width=194) (actual rows= loops=)

311. 0.000 0.000 ↓ 0.0

Unique (cost=63.07..63.10 rows=2 width=202) (actual rows= loops=)

312. 0.000 0.000 ↓ 0.0

Sort (cost=63.07..63.08 rows=2 width=202) (actual rows= loops=)

  • Sort Key: "*SELECT* 1_3".id_faturamento, "*SELECT* 1_3".contrato, "*SELECT* 1_3".numero_contrato, (("*SELECT* 1_3".total_recebido_nf)::double precision)
313. 0.000 0.000 ↓ 0.0

Append (cost=33.59..63.06 rows=2 width=202) (actual rows= loops=)

314. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1_3 (cost=33.59..33.64 rows=1 width=36) (actual rows= loops=)

315. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=33.59..33.63 rows=1 width=60) (actual rows= loops=)

  • Group Key: ftrmnt_18.id_faturamento, cntrt_25.id_contrato
316. 0.000 0.000 ↓ 0.0

Sort (cost=33.59..33.59 rows=1 width=49) (actual rows= loops=)

  • Sort Key: ftrmnt_18.id_faturamento, cntrt_25.id_contrato
317. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=20.41..33.58 rows=1 width=49) (actual rows= loops=)

318. 0.000 0.000 ↓ 0.0

Nested Loop (cost=20.14..33.10 rows=1 width=43) (actual rows= loops=)

319. 0.000 0.000 ↓ 0.0

Hash Join (cost=19.87..24.77 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_25.id_contrato = ftrmnt_18.nu_processo_compra)
320. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_25 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

321. 0.000 0.000 ↓ 0.0

Hash (cost=19.86..19.86 rows=1 width=16) (actual rows= loops=)

322. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_18 (cost=0.00..19.86 rows=1 width=16) (actual rows= loops=)

  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{12,13}'::bigint[])) AND (cd_tipo_faturamento = ANY ('{1,2,3,4}'::bigint[])))
323. 0.000 0.000 ↓ 0.0

Index Scan using tb_dcmnt_fscl_pkey on tb_dcmnt_fscl dcmntfscl_3 (cost=0.27..8.29 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (id_faturamento = ftrmnt_18.id_faturamento)
324. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_dcmnt_fscl_pkey on tb_tm_dcmnt_fscl ttdf_3 (cost=0.27..0.44 rows=3 width=22) (actual rows= loops=)

  • Index Cond: (id_faturamento = dcmntfscl_3.id_faturamento)
325. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=36) (actual rows= loops=)

  • Group Key: ftrmnt_19.id_faturamento, cntrt_26.id_contrato
326. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=36) (actual rows= loops=)

  • Sort Key: ftrmnt_19.id_faturamento, cntrt_26.id_contrato
327. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=36) (actual rows= loops=)

  • Hash Cond: (cntrt_26.id_contrato = ftrmnt_19.nu_processo_compra)
328. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_26 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

329. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=24) (actual rows= loops=)

330. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=24) (actual rows= loops=)

331. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_ltrnc_v2_0_pkey on tb_splh_nf_ltrnc_v2_0 splh_6 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

332. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_19 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_6.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (cd_tipo_faturamento = ANY ('{2,1}'::bigint[])) AND (in_situacao_faturamento = ANY ('{12,13}'::bigint[])))
333. 0.000 0.000 ↓ 0.0

Hash (cost=7.78..7.78 rows=90 width=11) (actual rows= loops=)

334. 0.000 0.000 ↓ 0.0

Hash Join (cost=3.02..7.78 rows=90 width=11) (actual rows= loops=)

  • Hash Cond: (cntrt_4.id_contrato = pre_1.id_contrato)
335. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_4 (cost=0.00..4.38 rows=138 width=8) (actual rows= loops=)

336. 0.000 0.000 ↓ 0.0

Hash (cost=1.90..1.90 rows=90 width=11) (actual rows= loops=)

337. 0.000 0.000 ↓ 0.0

Seq Scan on tb_vl_tlzd_pr_vtr pre_1 (cost=0.00..1.90 rows=90 width=11) (actual rows= loops=)

338. 0.000 0.000 ↓ 0.0

Materialize (cost=223.98..226.05 rows=138 width=40) (actual rows= loops=)

339. 0.000 0.000 ↓ 0.0

Sort (cost=223.98..224.33 rows=138 width=52) (actual rows= loops=)

  • Sort Key: tb_cntrt_6.id_contrato, tb_cntrt_6.nu_contrato
340. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=213.36..219.08 rows=138 width=52) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_6.id_contrato = tot_comprometido_homologado.contrato)
341. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=108.56..112.04 rows=138 width=52) (actual rows= loops=)

  • Hash Cond: (cntrt_27.id_contrato = tb_cntrt_6.id_contrato)
342. 0.000 0.000 ↓ 0.0

HashAggregate (cost=102.46..104.18 rows=138 width=52) (actual rows= loops=)

  • Group Key: cntrt_27.id_contrato
343. 0.000 0.000 ↓ 0.0

Hash Join (cost=47.13..101.32 rows=228 width=27) (actual rows= loops=)

  • Hash Cond: (rdm.id_contrato = cntrt_27.id_contrato)
344. 0.000 0.000 ↓ 0.0

Hash Join (cost=41.03..94.59 rows=228 width=15) (actual rows= loops=)

  • Hash Cond: (fas.id_ordem_servico = rdm.id_ordem_servico)
345. 0.000 0.000 ↓ 0.0

Hash Join (cost=27.95..80.67 rows=318 width=23) (actual rows= loops=)

  • Hash Cond: ((rdmtm.id_ordem_servico = fas.id_ordem_servico) AND (rdmtm.nu_fase = fas.nu_fase))
346. 0.000 0.000 ↓ 0.0

Seq Scan on tb_rdm_srvc_tm_cntrt rdmtm (cost=0.00..44.95 rows=1,471 width=17) (actual rows= loops=)

  • Filter: (id_autorizacao_faturamento IS NULL)
347. 0.000 0.000 ↓ 0.0

Hash (cost=26.63..26.63 rows=88 width=10) (actual rows= loops=)

348. 0.000 0.000 ↓ 0.0

Seq Scan on tb_fs_rdm_srvc fas (cost=0.00..26.63 rows=88 width=10) (actual rows= loops=)

  • Filter: (in_situacao_os = ANY ('{2,3,6,7,8,D,A}'::bpchar[]))
349. 0.000 0.000 ↓ 0.0

Hash (cost=10.54..10.54 rows=203 width=16) (actual rows= loops=)

350. 0.000 0.000 ↓ 0.0

Seq Scan on tb_rdm_srvc rdm (cost=0.00..10.54 rows=203 width=16) (actual rows= loops=)

  • Filter: (in_situacao_os = ANY ('{2,3}'::bpchar[]))
351. 0.000 0.000 ↓ 0.0

Hash (cost=4.38..4.38 rows=138 width=20) (actual rows= loops=)

352. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_27 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

353. 0.000 0.000 ↓ 0.0

Hash (cost=4.38..4.38 rows=138 width=20) (actual rows= loops=)

354. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt tb_cntrt_6 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

355. 0.000 0.000 ↓ 0.0

Hash (cost=103.07..103.07 rows=138 width=40) (actual rows= loops=)

356. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_comprometido_homologado (cost=99.96..103.07 rows=138 width=40) (actual rows= loops=)

357. 0.000 0.000 ↓ 0.0

HashAggregate (cost=99.96..101.69 rows=138 width=52) (actual rows= loops=)

  • Group Key: cntrt_28.id_contrato
358. 0.000 0.000 ↓ 0.0

Hash Join (cost=44.60..98.81 rows=231 width=27) (actual rows= loops=)

  • Hash Cond: (rdm_1.id_contrato = cntrt_28.id_contrato)
359. 0.000 0.000 ↓ 0.0

Hash Join (cost=38.50..92.08 rows=231 width=15) (actual rows= loops=)

  • Hash Cond: (fas_1.id_ordem_servico = rdm_1.id_ordem_servico)
360. 0.000 0.000 ↓ 0.0

Hash Join (cost=25.42..78.14 rows=322 width=23) (actual rows= loops=)

  • Hash Cond: ((rdmtm_1.id_ordem_servico = fas_1.id_ordem_servico) AND (rdmtm_1.nu_fase = fas_1.nu_fase))
361. 0.000 0.000 ↓ 0.0

Seq Scan on tb_rdm_srvc_tm_cntrt rdmtm_1 (cost=0.00..44.95 rows=1,471 width=17) (actual rows= loops=)

  • Filter: (id_autorizacao_faturamento IS NULL)
362. 0.000 0.000 ↓ 0.0

Hash (cost=24.09..24.09 rows=89 width=10) (actual rows= loops=)

363. 0.000 0.000 ↓ 0.0

Seq Scan on tb_fs_rdm_srvc fas_1 (cost=0.00..24.09 rows=89 width=10) (actual rows= loops=)

  • Filter: (in_situacao_os = '4'::bpchar)
364. 0.000 0.000 ↓ 0.0

Hash (cost=10.54..10.54 rows=203 width=16) (actual rows= loops=)

365. 0.000 0.000 ↓ 0.0

Seq Scan on tb_rdm_srvc rdm_1 (cost=0.00..10.54 rows=203 width=16) (actual rows= loops=)

  • Filter: (in_situacao_os = ANY ('{2,3}'::bpchar[]))
366. 0.000 0.000 ↓ 0.0

Hash (cost=4.38..4.38 rows=138 width=20) (actual rows= loops=)

367. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_28 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

368. 0.000 0.000 ↓ 0.0

Materialize (cost=172.03..174.10 rows=138 width=16) (actual rows= loops=)

369. 0.000 0.000 ↓ 0.0

Sort (cost=172.03..172.37 rows=138 width=28) (actual rows= loops=)

  • Sort Key: tb_cntrt_7.id_contrato, tb_cntrt_7.nu_contrato
370. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=159.13..167.12 rows=138 width=28) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_7.id_contrato = tot_recebido_sem_af_nfe_3.contrato)
371. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=95.92..101.99 rows=138 width=64) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_7.id_contrato = tot_recebido_sem_af_nf_3.contrato)
372. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=66.49..72.03 rows=138 width=56) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_7.id_contrato = tot_recebido_af_3.contrato)
373. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=32.73..37.64 rows=138 width=24) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_7.id_contrato = tot_faturado_af_reaj_3.contrato)
374. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt tb_cntrt_7 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

375. 0.000 0.000 ↓ 0.0

Hash (cost=32.72..32.72 rows=1 width=12) (actual rows= loops=)

376. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_faturado_af_reaj_3 (cost=32.69..32.72 rows=1 width=12) (actual rows= loops=)

377. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=32.69..32.71 rows=1 width=24) (actual rows= loops=)

  • Group Key: cntrt_29.id_contrato
378. 0.000 0.000 ↓ 0.0

Sort (cost=32.69..32.70 rows=1 width=24) (actual rows= loops=)

  • Sort Key: cntrt_29.id_contrato
379. 0.000 0.000 ↓ 0.0

Nested Loop (cost=10.11..32.68 rows=1 width=24) (actual rows= loops=)

  • Join Filter: (trzc_13.id_autorizacao_faturamento = ftrmnt_20.id_autorizacao_faturamento)
380. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_20 (cost=0.00..17.32 rows=5 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = ANY ('{9,21}'::bigint[]))
381. 0.000 0.000 ↓ 0.0

Materialize (cost=10.11..15.21 rows=2 width=32) (actual rows= loops=)

382. 0.000 0.000 ↓ 0.0

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual rows= loops=)

  • Hash Cond: (cntrt_29.id_contrato = trzc_13.id_contrato)
383. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_29 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

384. 0.000 0.000 ↓ 0.0

Hash (cost=10.09..10.09 rows=2 width=20) (actual rows= loops=)

385. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_13 (cost=0.00..10.09 rows=2 width=20) (actual rows= loops=)

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
386. 0.000 0.000 ↓ 0.0

Hash (cost=33.60..33.60 rows=12 width=40) (actual rows= loops=)

387. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_af_3 (cost=33.06..33.60 rows=12 width=40) (actual rows= loops=)

388. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=33.06..33.48 rows=12 width=52) (actual rows= loops=)

  • Group Key: cntrt_30.id_contrato
389. 0.000 0.000 ↓ 0.0

Sort (cost=33.06..33.09 rows=12 width=40) (actual rows= loops=)

  • Sort Key: cntrt_30.id_contrato
390. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.81..32.85 rows=12 width=40) (actual rows= loops=)

  • Join Filter: (ftrmnt_21.id_autorizacao_faturamento = tmtrzc_7.id_autorizacao_faturamento)
391. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.53..29.94 rows=5 width=36) (actual rows= loops=)

392. 0.000 0.000 ↓ 0.0

Hash Join (cost=17.39..28.84 rows=5 width=24) (actual rows= loops=)

  • Hash Cond: (trzc_14.id_autorizacao_faturamento = ftrmnt_21.id_autorizacao_faturamento)
393. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_14 (cost=0.00..10.09 rows=350 width=16) (actual rows= loops=)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
394. 0.000 0.000 ↓ 0.0

Hash (cost=17.32..17.32 rows=5 width=8) (actual rows= loops=)

395. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_21 (cost=0.00..17.32 rows=5 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = ANY ('{9,21}'::bigint[]))
396. 0.000 0.000 ↓ 0.0

Index Scan using tb_cntrt_id_contrato_idx on tb_cntrt cntrt_30 (cost=0.14..0.22 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id_contrato = trzc_14.id_contrato)
397. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_trzc_pkey on tb_tm_trzc tmtrzc_7 (cost=0.28..0.54 rows=3 width=28) (actual rows= loops=)

  • Index Cond: (id_autorizacao_faturamento = trzc_14.id_autorizacao_faturamento)
398. 0.000 0.000 ↓ 0.0

Hash (cost=29.42..29.42 rows=1 width=16) (actual rows= loops=)

399. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nf_3 (cost=29.39..29.42 rows=1 width=16) (actual rows= loops=)

400. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=28) (actual rows= loops=)

  • Group Key: cntrt_31.id_contrato
401. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=28) (actual rows= loops=)

  • Sort Key: cntrt_31.id_contrato
402. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_31.id_contrato = ftrmnt_22.nu_processo_compra)
403. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_31 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

404. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=16) (actual rows= loops=)

405. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=16) (actual rows= loops=)

406. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_fsc_pkey on tb_splh_nf_fsc splh_7 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

407. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_22 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_7.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{9,21}'::bigint[])) AND (cd_tipo_faturamento = 3))
408. 0.000 0.000 ↓ 0.0

Hash (cost=63.19..63.19 rows=2 width=16) (actual rows= loops=)

409. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nfe_3 (cost=63.13..63.19 rows=2 width=16) (actual rows= loops=)

410. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=63.13..63.17 rows=2 width=194) (actual rows= loops=)

  • Group Key: a_4.contrato, a_4.numero_contrato
411. 0.000 0.000 ↓ 0.0

Sort (cost=63.13..63.13 rows=2 width=194) (actual rows= loops=)

  • Sort Key: a_4.contrato, a_4.numero_contrato
412. 0.000 0.000 ↓ 0.0

Subquery Scan on a_4 (cost=63.07..63.12 rows=2 width=194) (actual rows= loops=)

413. 0.000 0.000 ↓ 0.0

Unique (cost=63.07..63.10 rows=2 width=202) (actual rows= loops=)

414. 0.000 0.000 ↓ 0.0

Sort (cost=63.07..63.08 rows=2 width=202) (actual rows= loops=)

  • Sort Key: "*SELECT* 1_4".id_faturamento, "*SELECT* 1_4".contrato, "*SELECT* 1_4".numero_contrato, (("*SELECT* 1_4".total_recebido_nf)::double precision)
415. 0.000 0.000 ↓ 0.0

Append (cost=33.59..63.06 rows=2 width=202) (actual rows= loops=)

416. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1_4 (cost=33.59..33.64 rows=1 width=36) (actual rows= loops=)

417. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=33.59..33.63 rows=1 width=60) (actual rows= loops=)

  • Group Key: ftrmnt_23.id_faturamento, cntrt_32.id_contrato
418. 0.000 0.000 ↓ 0.0

Sort (cost=33.59..33.59 rows=1 width=49) (actual rows= loops=)

  • Sort Key: ftrmnt_23.id_faturamento, cntrt_32.id_contrato
419. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=20.41..33.58 rows=1 width=49) (actual rows= loops=)

420. 0.000 0.000 ↓ 0.0

Nested Loop (cost=20.14..33.10 rows=1 width=43) (actual rows= loops=)

421. 0.000 0.000 ↓ 0.0

Hash Join (cost=19.87..24.77 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_32.id_contrato = ftrmnt_23.nu_processo_compra)
422. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_32 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

423. 0.000 0.000 ↓ 0.0

Hash (cost=19.86..19.86 rows=1 width=16) (actual rows= loops=)

424. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_23 (cost=0.00..19.86 rows=1 width=16) (actual rows= loops=)

  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{9,21}'::bigint[])) AND (cd_tipo_faturamento = ANY ('{1,2,3,4}'::bigint[])))
425. 0.000 0.000 ↓ 0.0

Index Scan using tb_dcmnt_fscl_pkey on tb_dcmnt_fscl dcmntfscl_4 (cost=0.27..8.29 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (id_faturamento = ftrmnt_23.id_faturamento)
426. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_dcmnt_fscl_pkey on tb_tm_dcmnt_fscl ttdf_4 (cost=0.27..0.44 rows=3 width=22) (actual rows= loops=)

  • Index Cond: (id_faturamento = dcmntfscl_4.id_faturamento)
427. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=36) (actual rows= loops=)

  • Group Key: ftrmnt_24.id_faturamento, cntrt_33.id_contrato
428. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=36) (actual rows= loops=)

  • Sort Key: ftrmnt_24.id_faturamento, cntrt_33.id_contrato
429. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=36) (actual rows= loops=)

  • Hash Cond: (cntrt_33.id_contrato = ftrmnt_24.nu_processo_compra)
430. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_33 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

431. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=24) (actual rows= loops=)

432. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=24) (actual rows= loops=)

433. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_ltrnc_v2_0_pkey on tb_splh_nf_ltrnc_v2_0 splh_8 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

434. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_24 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_8.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (cd_tipo_faturamento = ANY ('{2,1}'::bigint[])) AND (in_situacao_faturamento = ANY ('{9,21}'::bigint[])))
435. 0.000 0.000 ↓ 0.0

Materialize (cost=169.86..171.93 rows=138 width=16) (actual rows= loops=)

436. 0.000 0.000 ↓ 0.0

Sort (cost=169.86..170.21 rows=138 width=28) (actual rows= loops=)

  • Sort Key: tb_cntrt_8.id_contrato, tb_cntrt_8.nu_contrato
437. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=157.02..164.96 rows=138 width=28) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_8.id_contrato = tot_recebido_sem_af_nfe_4.contrato)
438. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=93.80..99.83 rows=138 width=64) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_8.id_contrato = tot_recebido_sem_af_nf_4.contrato)
439. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=64.37..69.87 rows=138 width=56) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_8.id_contrato = tot_faturado_af_reaj_4.contrato)
440. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=31.70..36.67 rows=138 width=52) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_8.id_contrato = tot_recebido_af_4.contrato)
441. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt tb_cntrt_8 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

442. 0.000 0.000 ↓ 0.0

Hash (cost=31.61..31.61 rows=7 width=40) (actual rows= loops=)

443. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_af_4 (cost=31.30..31.61 rows=7 width=40) (actual rows= loops=)

444. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=31.30..31.54 rows=7 width=52) (actual rows= loops=)

  • Group Key: cntrt_34.id_contrato
445. 0.000 0.000 ↓ 0.0

Sort (cost=31.30..31.31 rows=7 width=40) (actual rows= loops=)

  • Sort Key: cntrt_34.id_contrato
446. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.78..31.20 rows=7 width=40) (actual rows= loops=)

  • Join Filter: (ftrmnt_25.id_autorizacao_faturamento = tmtrzc_8.id_autorizacao_faturamento)
447. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.51..29.45 rows=3 width=36) (actual rows= loops=)

448. 0.000 0.000 ↓ 0.0

Hash Join (cost=17.36..28.79 rows=3 width=24) (actual rows= loops=)

  • Hash Cond: (trzc_15.id_autorizacao_faturamento = ftrmnt_25.id_autorizacao_faturamento)
449. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_15 (cost=0.00..10.09 rows=350 width=16) (actual rows= loops=)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
450. 0.000 0.000 ↓ 0.0

Hash (cost=17.32..17.32 rows=3 width=8) (actual rows= loops=)

451. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_25 (cost=0.00..17.32 rows=3 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = 22)
452. 0.000 0.000 ↓ 0.0

Index Scan using tb_cntrt_id_contrato_idx on tb_cntrt cntrt_34 (cost=0.14..0.22 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id_contrato = trzc_15.id_contrato)
453. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_trzc_pkey on tb_tm_trzc tmtrzc_8 (cost=0.28..0.54 rows=3 width=28) (actual rows= loops=)

  • Index Cond: (id_autorizacao_faturamento = trzc_15.id_autorizacao_faturamento)
454. 0.000 0.000 ↓ 0.0

Hash (cost=32.66..32.66 rows=1 width=12) (actual rows= loops=)

455. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_faturado_af_reaj_4 (cost=32.63..32.66 rows=1 width=12) (actual rows= loops=)

456. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=32.63..32.65 rows=1 width=24) (actual rows= loops=)

  • Group Key: cntrt_35.id_contrato
457. 0.000 0.000 ↓ 0.0

Sort (cost=32.63..32.64 rows=1 width=24) (actual rows= loops=)

  • Sort Key: cntrt_35.id_contrato
458. 0.000 0.000 ↓ 0.0

Nested Loop (cost=10.11..32.62 rows=1 width=24) (actual rows= loops=)

  • Join Filter: (trzc_16.id_autorizacao_faturamento = ftrmnt_26.id_autorizacao_faturamento)
459. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_26 (cost=0.00..17.32 rows=3 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = 22)
460. 0.000 0.000 ↓ 0.0

Materialize (cost=10.11..15.21 rows=2 width=32) (actual rows= loops=)

461. 0.000 0.000 ↓ 0.0

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual rows= loops=)

  • Hash Cond: (cntrt_35.id_contrato = trzc_16.id_contrato)
462. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_35 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

463. 0.000 0.000 ↓ 0.0

Hash (cost=10.09..10.09 rows=2 width=20) (actual rows= loops=)

464. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_16 (cost=0.00..10.09 rows=2 width=20) (actual rows= loops=)

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
465. 0.000 0.000 ↓ 0.0

Hash (cost=29.42..29.42 rows=1 width=16) (actual rows= loops=)

466. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nf_4 (cost=29.39..29.42 rows=1 width=16) (actual rows= loops=)

467. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=28) (actual rows= loops=)

  • Group Key: cntrt_36.id_contrato
468. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=28) (actual rows= loops=)

  • Sort Key: cntrt_36.id_contrato
469. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_36.id_contrato = ftrmnt_27.nu_processo_compra)
470. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_36 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

471. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=16) (actual rows= loops=)

472. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=16) (actual rows= loops=)

473. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_fsc_pkey on tb_splh_nf_fsc splh_9 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

474. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_27 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_9.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (cd_tipo_faturamento = 3) AND (in_situacao_faturamento = 22))
475. 0.000 0.000 ↓ 0.0

Hash (cost=63.19..63.19 rows=2 width=16) (actual rows= loops=)

476. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nfe_4 (cost=63.13..63.19 rows=2 width=16) (actual rows= loops=)

477. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=63.13..63.17 rows=2 width=194) (actual rows= loops=)

  • Group Key: a_5.contrato, a_5.numero_contrato
478. 0.000 0.000 ↓ 0.0

Sort (cost=63.13..63.13 rows=2 width=194) (actual rows= loops=)

  • Sort Key: a_5.contrato, a_5.numero_contrato
479. 0.000 0.000 ↓ 0.0

Subquery Scan on a_5 (cost=63.07..63.12 rows=2 width=194) (actual rows= loops=)

480. 0.000 0.000 ↓ 0.0

Unique (cost=63.07..63.10 rows=2 width=202) (actual rows= loops=)

481. 0.000 0.000 ↓ 0.0

Sort (cost=63.07..63.08 rows=2 width=202) (actual rows= loops=)

  • Sort Key: "*SELECT* 1_5".id_faturamento, "*SELECT* 1_5".contrato, "*SELECT* 1_5".numero_contrato, (("*SELECT* 1_5".total_recebido_nf)::double precision)
482. 0.000 0.000 ↓ 0.0

Append (cost=33.59..63.06 rows=2 width=202) (actual rows= loops=)

483. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1_5 (cost=33.59..33.64 rows=1 width=36) (actual rows= loops=)

484. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=33.59..33.63 rows=1 width=60) (actual rows= loops=)

  • Group Key: ftrmnt_28.id_faturamento, cntrt_37.id_contrato
485. 0.000 0.000 ↓ 0.0

Sort (cost=33.59..33.59 rows=1 width=49) (actual rows= loops=)

  • Sort Key: ftrmnt_28.id_faturamento, cntrt_37.id_contrato
486. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=20.41..33.58 rows=1 width=49) (actual rows= loops=)

487. 0.000 0.000 ↓ 0.0

Nested Loop (cost=20.14..33.10 rows=1 width=43) (actual rows= loops=)

488. 0.000 0.000 ↓ 0.0

Hash Join (cost=19.87..24.77 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_37.id_contrato = ftrmnt_28.nu_processo_compra)
489. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_37 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

490. 0.000 0.000 ↓ 0.0

Hash (cost=19.86..19.86 rows=1 width=16) (actual rows= loops=)

491. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_28 (cost=0.00..19.86 rows=1 width=16) (actual rows= loops=)

  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = 22) AND (cd_tipo_faturamento = ANY ('{1,2,3,4}'::bigint[])))
492. 0.000 0.000 ↓ 0.0

Index Scan using tb_dcmnt_fscl_pkey on tb_dcmnt_fscl dcmntfscl_5 (cost=0.27..8.29 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (id_faturamento = ftrmnt_28.id_faturamento)
493. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_dcmnt_fscl_pkey on tb_tm_dcmnt_fscl ttdf_5 (cost=0.27..0.44 rows=3 width=22) (actual rows= loops=)

  • Index Cond: (id_faturamento = dcmntfscl_5.id_faturamento)
494. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=36) (actual rows= loops=)

  • Group Key: ftrmnt_29.id_faturamento, cntrt_38.id_contrato
495. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=36) (actual rows= loops=)

  • Sort Key: ftrmnt_29.id_faturamento, cntrt_38.id_contrato
496. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=36) (actual rows= loops=)

  • Hash Cond: (cntrt_38.id_contrato = ftrmnt_29.nu_processo_compra)
497. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_38 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

498. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=24) (actual rows= loops=)

499. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=24) (actual rows= loops=)

500. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_ltrnc_v2_0_pkey on tb_splh_nf_ltrnc_v2_0 splh_10 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

501. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_29 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_10.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (cd_tipo_faturamento = ANY ('{2,1}'::bigint[])) AND (in_situacao_faturamento = 22))
502. 0.000 0.000 ↓ 0.0

Materialize (cost=182.47..184.54 rows=138 width=16) (actual rows= loops=)

503. 0.000 0.000 ↓ 0.0

Sort (cost=182.47..182.81 rows=138 width=28) (actual rows= loops=)

  • Sort Key: tb_cntrt_9.id_contrato, tb_cntrt_9.nu_contrato
504. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=168.26..177.56 rows=138 width=28) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_9.id_contrato = tot_recebido_sem_af_nfe_5.contrato)
505. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=105.05..111.74 rows=138 width=67) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_9.id_contrato = tot_recebido_sem_af_nf_5.contrato)
506. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=75.62..81.78 rows=138 width=59) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_9.id_contrato = tot_recebido_af_5.contrato)
507. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=41.86..47.39 rows=138 width=27) (actual rows= loops=)

  • Hash Cond: (tb_cntrt_9.id_contrato = tot_faturado_af_reaj_5.contrato)
508. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=9.13..14.13 rows=138 width=23) (actual rows= loops=)

  • Hash Cond: (cntrt_39.id_contrato = tb_cntrt_9.id_contrato)
509. 0.000 0.000 ↓ 0.0

Hash Join (cost=3.02..7.78 rows=90 width=11) (actual rows= loops=)

  • Hash Cond: (cntrt_39.id_contrato = pre_3.id_contrato)
510. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_39 (cost=0.00..4.38 rows=138 width=8) (actual rows= loops=)

511. 0.000 0.000 ↓ 0.0

Hash (cost=1.90..1.90 rows=90 width=11) (actual rows= loops=)

512. 0.000 0.000 ↓ 0.0

Seq Scan on tb_vl_tlzd_pr_vtr pre_3 (cost=0.00..1.90 rows=90 width=11) (actual rows= loops=)

513. 0.000 0.000 ↓ 0.0

Hash (cost=4.38..4.38 rows=138 width=20) (actual rows= loops=)

514. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt tb_cntrt_9 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

515. 0.000 0.000 ↓ 0.0

Hash (cost=32.72..32.72 rows=1 width=12) (actual rows= loops=)

516. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_faturado_af_reaj_5 (cost=32.69..32.72 rows=1 width=12) (actual rows= loops=)

517. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=32.69..32.71 rows=1 width=24) (actual rows= loops=)

  • Group Key: cntrt_40.id_contrato
518. 0.000 0.000 ↓ 0.0

Sort (cost=32.69..32.70 rows=1 width=24) (actual rows= loops=)

  • Sort Key: cntrt_40.id_contrato
519. 0.000 0.000 ↓ 0.0

Nested Loop (cost=10.11..32.68 rows=1 width=24) (actual rows= loops=)

  • Join Filter: (trzc_17.id_autorizacao_faturamento = ftrmnt_30.id_autorizacao_faturamento)
520. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_30 (cost=0.00..17.32 rows=5 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = ANY ('{12,13}'::bigint[]))
521. 0.000 0.000 ↓ 0.0

Materialize (cost=10.11..15.21 rows=2 width=32) (actual rows= loops=)

522. 0.000 0.000 ↓ 0.0

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual rows= loops=)

  • Hash Cond: (cntrt_40.id_contrato = trzc_17.id_contrato)
523. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_40 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

524. 0.000 0.000 ↓ 0.0

Hash (cost=10.09..10.09 rows=2 width=20) (actual rows= loops=)

525. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_17 (cost=0.00..10.09 rows=2 width=20) (actual rows= loops=)

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
526. 0.000 0.000 ↓ 0.0

Hash (cost=33.60..33.60 rows=12 width=40) (actual rows= loops=)

527. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_af_5 (cost=33.06..33.60 rows=12 width=40) (actual rows= loops=)

528. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=33.06..33.48 rows=12 width=52) (actual rows= loops=)

  • Group Key: cntrt_41.id_contrato
529. 0.000 0.000 ↓ 0.0

Sort (cost=33.06..33.09 rows=12 width=40) (actual rows= loops=)

  • Sort Key: cntrt_41.id_contrato
530. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.81..32.85 rows=12 width=40) (actual rows= loops=)

  • Join Filter: (ftrmnt_31.id_autorizacao_faturamento = tmtrzc_9.id_autorizacao_faturamento)
531. 0.000 0.000 ↓ 0.0

Nested Loop (cost=17.53..29.94 rows=5 width=36) (actual rows= loops=)

532. 0.000 0.000 ↓ 0.0

Hash Join (cost=17.39..28.84 rows=5 width=24) (actual rows= loops=)

  • Hash Cond: (trzc_18.id_autorizacao_faturamento = ftrmnt_31.id_autorizacao_faturamento)
533. 0.000 0.000 ↓ 0.0

Seq Scan on tb_trzc_ftrmnt trzc_18 (cost=0.00..10.09 rows=350 width=16) (actual rows= loops=)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
534. 0.000 0.000 ↓ 0.0

Hash (cost=17.32..17.32 rows=5 width=8) (actual rows= loops=)

535. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_31 (cost=0.00..17.32 rows=5 width=8) (actual rows= loops=)

  • Filter: (in_situacao_faturamento = ANY ('{12,13}'::bigint[]))
536. 0.000 0.000 ↓ 0.0

Index Scan using tb_cntrt_id_contrato_idx on tb_cntrt cntrt_41 (cost=0.14..0.22 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id_contrato = trzc_18.id_contrato)
537. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_trzc_pkey on tb_tm_trzc tmtrzc_9 (cost=0.28..0.54 rows=3 width=28) (actual rows= loops=)

  • Index Cond: (id_autorizacao_faturamento = trzc_18.id_autorizacao_faturamento)
538. 0.000 0.000 ↓ 0.0

Hash (cost=29.42..29.42 rows=1 width=16) (actual rows= loops=)

539. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nf_5 (cost=29.39..29.42 rows=1 width=16) (actual rows= loops=)

540. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=28) (actual rows= loops=)

  • Group Key: cntrt_42.id_contrato
541. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=28) (actual rows= loops=)

  • Sort Key: cntrt_42.id_contrato
542. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_42.id_contrato = ftrmnt_32.nu_processo_compra)
543. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_42 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

544. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=16) (actual rows= loops=)

545. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=16) (actual rows= loops=)

546. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_fsc_pkey on tb_splh_nf_fsc splh_11 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

547. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_32 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_11.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{12,13}'::bigint[])) AND (cd_tipo_faturamento = 3))
548. 0.000 0.000 ↓ 0.0

Hash (cost=63.19..63.19 rows=2 width=16) (actual rows= loops=)

549. 0.000 0.000 ↓ 0.0

Subquery Scan on tot_recebido_sem_af_nfe_5 (cost=63.13..63.19 rows=2 width=16) (actual rows= loops=)

550. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=63.13..63.17 rows=2 width=194) (actual rows= loops=)

  • Group Key: a_6.contrato, a_6.numero_contrato
551. 0.000 0.000 ↓ 0.0

Sort (cost=63.13..63.13 rows=2 width=194) (actual rows= loops=)

  • Sort Key: a_6.contrato, a_6.numero_contrato
552. 0.000 0.000 ↓ 0.0

Subquery Scan on a_6 (cost=63.07..63.12 rows=2 width=194) (actual rows= loops=)

553. 0.000 0.000 ↓ 0.0

Unique (cost=63.07..63.10 rows=2 width=202) (actual rows= loops=)

554. 0.000 0.000 ↓ 0.0

Sort (cost=63.07..63.08 rows=2 width=202) (actual rows= loops=)

  • Sort Key: "*SELECT* 1_6".id_faturamento, "*SELECT* 1_6".contrato, "*SELECT* 1_6".numero_contrato, (("*SELECT* 1_6".total_recebido_nf)::double precision)
555. 0.000 0.000 ↓ 0.0

Append (cost=33.59..63.06 rows=2 width=202) (actual rows= loops=)

556. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1_6 (cost=33.59..33.64 rows=1 width=36) (actual rows= loops=)

557. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=33.59..33.63 rows=1 width=60) (actual rows= loops=)

  • Group Key: ftrmnt_33.id_faturamento, cntrt_43.id_contrato
558. 0.000 0.000 ↓ 0.0

Sort (cost=33.59..33.59 rows=1 width=49) (actual rows= loops=)

  • Sort Key: ftrmnt_33.id_faturamento, cntrt_43.id_contrato
559. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=20.41..33.58 rows=1 width=49) (actual rows= loops=)

560. 0.000 0.000 ↓ 0.0

Nested Loop (cost=20.14..33.10 rows=1 width=43) (actual rows= loops=)

561. 0.000 0.000 ↓ 0.0

Hash Join (cost=19.87..24.77 rows=1 width=28) (actual rows= loops=)

  • Hash Cond: (cntrt_43.id_contrato = ftrmnt_33.nu_processo_compra)
562. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_43 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

563. 0.000 0.000 ↓ 0.0

Hash (cost=19.86..19.86 rows=1 width=16) (actual rows= loops=)

564. 0.000 0.000 ↓ 0.0

Seq Scan on tb_ftrmnt ftrmnt_33 (cost=0.00..19.86 rows=1 width=16) (actual rows= loops=)

  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{12,13}'::bigint[])) AND (cd_tipo_faturamento = ANY ('{1,2,3,4}'::bigint[])))
565. 0.000 0.000 ↓ 0.0

Index Scan using tb_dcmnt_fscl_pkey on tb_dcmnt_fscl dcmntfscl_6 (cost=0.27..8.29 rows=1 width=15) (actual rows= loops=)

  • Index Cond: (id_faturamento = ftrmnt_33.id_faturamento)
566. 0.000 0.000 ↓ 0.0

Index Scan using tb_tm_dcmnt_fscl_pkey on tb_tm_dcmnt_fscl ttdf_6 (cost=0.27..0.44 rows=3 width=22) (actual rows= loops=)

  • Index Cond: (id_faturamento = dcmntfscl_6.id_faturamento)
567. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=29.39..29.41 rows=1 width=36) (actual rows= loops=)

  • Group Key: ftrmnt_34.id_faturamento, cntrt_44.id_contrato
568. 0.000 0.000 ↓ 0.0

Sort (cost=29.39..29.39 rows=1 width=36) (actual rows= loops=)

  • Sort Key: ftrmnt_34.id_faturamento, cntrt_44.id_contrato
569. 0.000 0.000 ↓ 0.0

Hash Join (cost=24.47..29.38 rows=1 width=36) (actual rows= loops=)

  • Hash Cond: (cntrt_44.id_contrato = ftrmnt_34.nu_processo_compra)
570. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt_44 (cost=0.00..4.38 rows=138 width=20) (actual rows= loops=)

571. 0.000 0.000 ↓ 0.0

Hash (cost=24.46..24.46 rows=1 width=24) (actual rows= loops=)

572. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.40..24.46 rows=1 width=24) (actual rows= loops=)

573. 0.000 0.000 ↓ 0.0

Index Scan using tb_splh_nf_ltrnc_v2_0_pkey on tb_splh_nf_ltrnc_v2_0 splh_12 (cost=0.12..8.14 rows=1 width=16) (actual rows= loops=)

574. 0.000 0.000 ↓ 0.0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_34 (cost=0.27..8.30 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id_faturamento = splh_12.id_faturamento)
  • Filter: ((id_autorizacao_faturamento IS NULL) AND (cd_tipo_faturamento = ANY ('{2,1}'::bigint[])) AND (in_situacao_faturamento = ANY ('{12,13}'::bigint[])))
575. 0.000 0.000 ↓ 0.0

Hash (cost=7.78..7.78 rows=90 width=8) (actual rows= loops=)

576. 0.000 0.000 ↓ 0.0

Hash Join (cost=3.02..7.78 rows=90 width=8) (actual rows= loops=)

  • Hash Cond: (cntrt.id_contrato = pre.id_contrato)
577. 0.000 0.000 ↓ 0.0

Seq Scan on tb_cntrt cntrt (cost=0.00..4.38 rows=138 width=8) (actual rows= loops=)

578. 0.000 0.000 ↓ 0.0

Hash (cost=1.90..1.90 rows=90 width=8) (actual rows= loops=)

579. 0.000 0.000 ↓ 0.0

Seq Scan on tb_vl_tlzd_pr_vtr pre (cost=0.00..1.90 rows=90 width=8) (actual rows= loops=)