explain.depesz.com

PostgreSQL's explain analyze made readable

Result: LNGz

Settings
# exclusive inclusive rows x rows loops node
1. 0.071 18.698 ↑ 1.3 103 1

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

  • Sort Key: tb_cntrt.id_contrato, tb_cntrt.nu_contrato
  • Sort Method: quicksort Memory: 39kB
2. 0.156 18.627 ↑ 1.3 103 1

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

  • Hash Cond: (tb_cntrt.id_contrato = cntrt.id_contrato)
3. 0.049 18.383 ↑ 1.3 103 1

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

  • Merge Cond: (tb_cntrt.id_contrato = tb_cntrt_9.id_contrato)
4. 0.040 15.445 ↑ 1.3 103 1

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

  • Merge Cond: (tb_cntrt.id_contrato = tb_cntrt_8.id_contrato)
5. 0.040 14.519 ↑ 1.3 103 1

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

  • Merge Cond: (tb_cntrt.id_contrato = tb_cntrt_7.id_contrato)
6. 0.041 12.840 ↑ 1.3 103 1

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

  • Merge Cond: (tb_cntrt.id_contrato = tb_cntrt_6.id_contrato)
7. 0.048 10.314 ↑ 1.3 103 1

Merge Left Join (cost=912.01..916.50 rows=138 width=43) (actual time=10.242..10.314 rows=103 loops=1)

  • Merge Cond: (tb_cntrt.id_contrato = tb_cntrt_2.id_contrato)
8. 0.046 1.144 ↑ 1.3 103 1

Sort (cost=98.62..98.97 rows=138 width=35) (actual time=1.137..1.144 rows=103 loops=1)

  • Sort Key: tb_cntrt.id_contrato
  • Sort Method: quicksort Memory: 33kB
9. 0.040 1.098 ↑ 1.3 103 1

Hash Right Join (cost=91.62..93.72 rows=138 width=35) (actual time=1.064..1.098 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_1.id_contrato = tb_cntrt.id_contrato)
10. 0.049 0.987 ↑ 1.3 103 1

Sort (cost=85.52..85.86 rows=138 width=28) (actual time=0.982..0.987 rows=103 loops=1)

  • Sort Key: tb_cntrt_1.id_contrato, tb_cntrt_1.nu_contrato
  • Sort Method: quicksort Memory: 33kB
11. 0.074 0.938 ↑ 1.3 103 1

Hash Left Join (cost=73.18..80.61 rows=138 width=28) (actual time=0.844..0.938 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_1.id_contrato = tot_af_inicio_faturamento.contrato)
12. 0.033 0.366 ↑ 1.3 103 1

Hash Left Join (cost=41.58..47.05 rows=138 width=56) (actual time=0.323..0.366 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_1.id_contrato = tot_autorizado_faturar_reaj.contrato)
13. 0.034 0.225 ↑ 1.3 103 1

Hash Left Join (cost=26.51..31.42 rows=138 width=52) (actual time=0.196..0.225 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_1.id_contrato = tot_autorizado_faturar.contrato)
14. 0.017 0.017 ↑ 1.3 103 1

Seq Scan on tb_cntrt tb_cntrt_1 (cost=0.00..4.38 rows=138 width=20) (actual time=0.005..0.017 rows=103 loops=1)

15. 0.008 0.174 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
16. 0.001 0.166 ↑ 1.0 2 1

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

17. 0.044 0.165 ↑ 1.0 2 1

GroupAggregate (cost=26.42..26.46 rows=2 width=52) (actual time=0.163..0.165 rows=2 loops=1)

  • Group Key: cntrt_1.id_contrato
18. 0.014 0.121 ↑ 1.0 2 1

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

  • Sort Key: cntrt_1.id_contrato
  • Sort Method: quicksort Memory: 25kB
19. 0.005 0.107 ↑ 1.0 2 1

Nested Loop (cost=13.94..26.41 rows=2 width=27) (actual time=0.086..0.107 rows=2 loops=1)

20. 0.025 0.080 ↓ 2.0 2 1

Hash Join (cost=9.64..14.54 rows=1 width=28) (actual time=0.067..0.080 rows=2 loops=1)

  • Hash Cond: (cntrt_1.id_contrato = trzc.id_contrato)
21. 0.011 0.011 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_1 (cost=0.00..4.38 rows=138 width=20) (actual time=0.003..0.011 rows=103 loops=1)

22. 0.005 0.044 ↓ 2.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
23. 0.039 0.039 ↓ 2.0 2 1

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

  • Filter: (in_situacao = 2)
  • Rows Removed by Filter: 327
24. 0.010 0.022 ↑ 3.0 1 2

Bitmap Heap Scan on tb_tm_trzc tmtrzc (cost=4.30..11.84 rows=3 width=15) (actual time=0.010..0.011 rows=1 loops=2)

  • Recheck Cond: (id_autorizacao_faturamento = trzc.id_autorizacao_faturamento)
  • Heap Blocks: exact=2
25. 0.012 0.012 ↑ 3.0 1 2

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

  • Index Cond: (id_autorizacao_faturamento = trzc.id_autorizacao_faturamento)
26. 0.005 0.108 ↑ 1.5 2 1

Hash (cost=15.04..15.04 rows=3 width=12) (actual time=0.108..0.108 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
27. 0.001 0.103 ↑ 1.5 2 1

Subquery Scan on tot_autorizado_faturar_reaj (cost=14.96..15.04 rows=3 width=12) (actual time=0.101..0.103 rows=2 loops=1)

28. 0.002 0.102 ↑ 1.5 2 1

GroupAggregate (cost=14.96..15.01 rows=3 width=24) (actual time=0.101..0.102 rows=2 loops=1)

  • Group Key: cntrt_2.id_contrato
29. 0.009 0.100 ↑ 1.5 2 1

Sort (cost=14.96..14.97 rows=3 width=24) (actual time=0.099..0.100 rows=2 loops=1)

  • Sort Key: cntrt_2.id_contrato
  • Sort Method: quicksort Memory: 25kB
30. 0.020 0.091 ↑ 1.5 2 1

Hash Join (cost=9.66..14.93 rows=3 width=24) (actual time=0.078..0.091 rows=2 loops=1)

  • Hash Cond: (cntrt_2.id_contrato = trzc_1.id_contrato)
31. 0.013 0.013 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_2 (cost=0.00..4.38 rows=138 width=20) (actual time=0.005..0.013 rows=103 loops=1)

32. 0.016 0.058 ↑ 1.5 2 1

Hash (cost=9.62..9.62 rows=3 width=12) (actual time=0.058..0.058 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
33. 0.042 0.042 ↑ 1.5 2 1

Seq Scan on tb_trzc_ftrmnt trzc_1 (cost=0.00..9.62 rows=3 width=12) (actual time=0.021..0.042 rows=2 loops=1)

  • Filter: (in_situacao = ANY ('{1,2}'::integer[]))
  • Rows Removed by Filter: 327
34. 0.006 0.498 ↑ 1.4 5 1

Hash (cost=31.51..31.51 rows=7 width=40) (actual time=0.498..0.498 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
35. 0.001 0.492 ↑ 1.4 5 1

Subquery Scan on tot_af_inicio_faturamento (cost=31.30..31.51 rows=7 width=40) (actual time=0.452..0.492 rows=5 loops=1)

36. 0.051 0.491 ↑ 1.4 5 1

GroupAggregate (cost=31.30..31.44 rows=7 width=52) (actual time=0.451..0.491 rows=5 loops=1)

  • Group Key: cntrt_3.id_contrato
37. 0.061 0.440 ↓ 21.1 148 1

Sort (cost=31.30..31.31 rows=7 width=34) (actual time=0.433..0.440 rows=148 loops=1)

  • Sort Key: cntrt_3.id_contrato
  • Sort Method: quicksort Memory: 36kB
38. 0.046 0.379 ↓ 21.1 148 1

Nested Loop (cost=17.78..31.20 rows=7 width=34) (actual time=0.166..0.379 rows=148 loops=1)

  • Join Filter: (ftrmnt.id_autorizacao_faturamento = tmtrzc_1.id_autorizacao_faturamento)
39. 0.003 0.261 ↓ 8.0 24 1

Nested Loop (cost=17.51..29.45 rows=3 width=36) (actual time=0.153..0.261 rows=24 loops=1)

40. 0.039 0.210 ↓ 8.0 24 1

Hash Join (cost=17.36..28.79 rows=3 width=24) (actual time=0.139..0.210 rows=24 loops=1)

  • Hash Cond: (trzc_2.id_autorizacao_faturamento = ftrmnt.id_autorizacao_faturamento)
41. 0.050 0.050 ↑ 1.1 309 1

Seq Scan on tb_trzc_ftrmnt trzc_2 (cost=0.00..10.09 rows=350 width=16) (actual time=0.004..0.050 rows=309 loops=1)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
  • Rows Removed by Filter: 20
42. 0.008 0.121 ↓ 8.0 24 1

Hash (cost=17.32..17.32 rows=3 width=8) (actual time=0.121..0.121 rows=24 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
43. 0.113 0.113 ↓ 8.0 24 1

Seq Scan on tb_ftrmnt ftrmnt (cost=0.00..17.32 rows=3 width=8) (actual time=0.027..0.113 rows=24 loops=1)

  • Filter: (in_situacao_faturamento = 1)
  • Rows Removed by Filter: 422
44. 0.048 0.048 ↑ 1.0 1 24

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

  • Index Cond: (id_contrato = trzc_2.id_contrato)
45. 0.072 0.072 ↓ 2.0 6 24

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

  • Index Cond: (id_autorizacao_faturamento = trzc_2.id_autorizacao_faturamento)
46. 0.029 0.071 ↑ 1.3 103 1

Hash (cost=4.38..4.38 rows=138 width=27) (actual time=0.071..0.071 rows=103 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
47. 0.042 0.042 ↑ 1.3 103 1

Seq Scan on tb_cntrt (cost=0.00..4.38 rows=138 width=27) (actual time=0.015..0.042 rows=103 loops=1)

48. 0.016 9.122 ↑ 1.3 103 1

Materialize (cost=813.39..815.46 rows=138 width=16) (actual time=9.103..9.122 rows=103 loops=1)

49. 0.041 9.106 ↑ 1.3 103 1

Sort (cost=813.39..813.73 rows=138 width=28) (actual time=9.099..9.106 rows=103 loops=1)

  • Sort Key: tb_cntrt_2.id_contrato, tb_cntrt_2.nu_contrato
  • Sort Method: quicksort Memory: 33kB
50. 0.150 9.065 ↑ 1.3 103 1

Hash Left Join (cost=788.77..808.48 rows=138 width=28) (actual time=8.675..9.065 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_2.id_contrato = cntrt_4.id_contrato)
51. 0.046 8.815 ↑ 1.3 103 1

Merge Left Join (cost=779.87..794.37 rows=138 width=124) (actual time=8.545..8.815 rows=103 loops=1)

  • Merge Cond: (tb_cntrt_2.id_contrato = tb_cntrt_5.id_contrato)
52. 0.039 5.858 ↑ 1.3 103 1

Merge Left Join (cost=597.40..607.76 rows=138 width=116) (actual time=5.652..5.858 rows=103 loops=1)

  • Merge Cond: (tb_cntrt_2.id_contrato = tb_cntrt_4.id_contrato)
53. 0.041 4.948 ↑ 1.3 103 1

Merge Left Join (cost=427.54..433.76 rows=138 width=108) (actual time=4.796..4.948 rows=103 loops=1)

  • Merge Cond: (tb_cntrt_2.id_contrato = tb_cntrt_3.id_contrato)
54. 0.015 3.357 ↑ 1.3 103 1

Merge Left Join (cost=255.52..257.59 rows=138 width=100) (actual time=3.261..3.357 rows=103 loops=1)

  • Merge Cond: (tb_cntrt_2.id_contrato = cntrt_10.id_contrato)
55. 0.015 3.287 ↑ 1.3 103 1

Merge Left Join (cost=240.96..242.65 rows=138 width=96) (actual time=3.205..3.287 rows=103 loops=1)

  • Merge Cond: (tb_cntrt_2.id_contrato = cntrt_9.id_contrato)
56. 0.015 3.219 ↑ 1.3 103 1

Merge Left Join (cost=214.54..215.79 rows=138 width=64) (actual time=3.151..3.219 rows=103 loops=1)

  • Merge Cond: (tb_cntrt_2.id_contrato = a.contrato)
57. 0.022 2.075 ↑ 1.3 103 1

Merge Left Join (cost=150.78..151.59 rows=138 width=56) (actual time=2.045..2.075 rows=103 loops=1)

  • Merge Cond: (tb_cntrt_2.id_contrato = cntrt_6.id_contrato)
58. 0.046 1.841 ↑ 1.3 103 1

Sort (cost=117.93..118.28 rows=138 width=52) (actual time=1.833..1.841 rows=103 loops=1)

  • Sort Key: tb_cntrt_2.id_contrato
  • Sort Method: quicksort Memory: 32kB
59. 0.034 1.795 ↑ 1.3 103 1

Hash Right Join (cost=108.17..113.03 rows=138 width=52) (actual time=1.719..1.795 rows=103 loops=1)

  • Hash Cond: (cntrt_5.id_contrato = tb_cntrt_2.id_contrato)
60. 0.430 1.716 ↑ 2.1 67 1

HashAggregate (cost=102.06..105.17 rows=138 width=52) (actual time=1.664..1.716 rows=67 loops=1)

  • Group Key: cntrt_5.id_contrato
61. 0.189 1.286 ↑ 1.5 780 1

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

  • Hash Cond: (trzc_3.id_contrato = cntrt_5.id_contrato)
62. 0.196 1.058 ↑ 1.5 780 1

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

  • Hash Cond: (ftrmnt_1.id_autorizacao_faturamento = trzc_3.id_autorizacao_faturamento)
63. 0.120 0.120 ↑ 1.2 403 1

Seq Scan on tb_ftrmnt ftrmnt_1 (cost=0.00..17.96 rows=498 width=8) (actual time=0.014..0.120 rows=403 loops=1)

  • Filter: (in_situacao_faturamento <> ALL ('{1,4,8}'::bigint[]))
  • Rows Removed by Filter: 43
64. 0.222 0.742 ↓ 1.1 929 1

Hash (cost=38.09..38.09 rows=869 width=44) (actual time=0.742..0.742 rows=929 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 77kB
65. 0.320 0.520 ↓ 1.1 929 1

Hash Join (cost=14.46..38.09 rows=869 width=44) (actual time=0.118..0.520 rows=929 loops=1)

  • Hash Cond: (tmtrzc_2.id_autorizacao_faturamento = trzc_3.id_autorizacao_faturamento)
66. 0.098 0.098 ↓ 1.0 958 1

Seq Scan on tb_tm_trzc tmtrzc_2 (cost=0.00..21.19 rows=919 width=28) (actual time=0.005..0.098 rows=958 loops=1)

67. 0.047 0.102 ↑ 1.1 309 1

Hash (cost=10.09..10.09 rows=350 width=16) (actual time=0.102..0.102 rows=309 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 23kB
68. 0.055 0.055 ↑ 1.1 309 1

Seq Scan on tb_trzc_ftrmnt trzc_3 (cost=0.00..10.09 rows=350 width=16) (actual time=0.004..0.055 rows=309 loops=1)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
  • Rows Removed by Filter: 20
69. 0.023 0.039 ↑ 1.3 103 1

Hash (cost=4.38..4.38 rows=138 width=20) (actual time=0.039..0.039 rows=103 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
70. 0.016 0.016 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_5 (cost=0.00..4.38 rows=138 width=20) (actual time=0.003..0.016 rows=103 loops=1)

71. 0.027 0.045 ↑ 1.3 103 1

Hash (cost=4.38..4.38 rows=138 width=20) (actual time=0.045..0.045 rows=103 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
72. 0.018 0.018 ↑ 1.3 103 1

Seq Scan on tb_cntrt tb_cntrt_2 (cost=0.00..4.38 rows=138 width=20) (actual time=0.004..0.018 rows=103 loops=1)

73. 0.004 0.212 ↑ 1.5 2 1

Materialize (cost=32.85..32.94 rows=3 width=12) (actual time=0.210..0.212 rows=2 loops=1)

74. 0.004 0.208 ↑ 1.5 2 1

GroupAggregate (cost=32.85..32.90 rows=3 width=24) (actual time=0.206..0.208 rows=2 loops=1)

  • Group Key: cntrt_6.id_contrato
75. 0.012 0.204 ↑ 1.5 2 1

Sort (cost=32.85..32.85 rows=3 width=24) (actual time=0.204..0.204 rows=2 loops=1)

  • Sort Key: cntrt_6.id_contrato
  • Sort Method: quicksort Memory: 25kB
76. 0.027 0.192 ↑ 1.5 2 1

Hash Join (cost=27.55..32.82 rows=3 width=24) (actual time=0.178..0.192 rows=2 loops=1)

  • Hash Cond: (cntrt_6.id_contrato = trzc_4.id_contrato)
77. 0.014 0.014 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_6 (cost=0.00..4.38 rows=138 width=20) (actual time=0.006..0.014 rows=103 loops=1)

78. 0.003 0.151 ↑ 1.5 2 1

Hash (cost=27.51..27.51 rows=3 width=12) (actual time=0.151..0.151 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
79. 0.071 0.148 ↑ 1.5 2 1

Hash Join (cost=10.11..27.51 rows=3 width=12) (actual time=0.107..0.148 rows=2 loops=1)

  • Hash Cond: (ftrmnt_2.id_autorizacao_faturamento = trzc_4.id_autorizacao_faturamento)
80. 0.035 0.035 ↑ 1.1 446 1

Seq Scan on tb_ftrmnt ftrmnt_2 (cost=0.00..16.06 rows=506 width=8) (actual time=0.002..0.035 rows=446 loops=1)

81. 0.003 0.042 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
82. 0.039 0.039 ↑ 1.0 2 1

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

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
  • Rows Removed by Filter: 327
83. 0.012 1.129 ↑ 1.0 2 1

Materialize (cost=63.76..63.83 rows=2 width=16) (actual time=1.105..1.129 rows=2 loops=1)

84. 0.021 1.117 ↑ 1.0 2 1

GroupAggregate (cost=63.76..63.80 rows=2 width=194) (actual time=1.094..1.117 rows=2 loops=1)

  • Group Key: a.contrato, a.numero_contrato
85. 0.059 1.096 ↓ 58.0 116 1

Sort (cost=63.76..63.77 rows=2 width=194) (actual time=1.091..1.096 rows=116 loops=1)

  • Sort Key: a.contrato, a.numero_contrato
  • Sort Method: quicksort Memory: 34kB
86. 0.016 1.037 ↓ 58.0 116 1

Subquery Scan on a (cost=63.71..63.75 rows=2 width=194) (actual time=0.984..1.037 rows=116 loops=1)

87. 0.032 1.021 ↓ 58.0 116 1

Unique (cost=63.71..63.73 rows=2 width=202) (actual time=0.983..1.021 rows=116 loops=1)

88. 0.041 0.989 ↓ 58.0 116 1

Sort (cost=63.71..63.71 rows=2 width=202) (actual time=0.982..0.989 rows=116 loops=1)

  • Sort Key: "*SELECT* 1".id_faturamento, "*SELECT* 1".contrato, "*SELECT* 1".numero_contrato, (("*SELECT* 1".total_faturado_nf)::double precision)
  • Sort Method: quicksort Memory: 34kB
89. 0.009 0.948 ↓ 58.0 116 1

Append (cost=34.22..63.70 rows=2 width=202) (actual time=0.651..0.948 rows=116 loops=1)

90. 0.067 0.896 ↓ 116.0 116 1

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

91. 0.195 0.829 ↓ 116.0 116 1

GroupAggregate (cost=34.22..34.26 rows=1 width=60) (actual time=0.637..0.829 rows=116 loops=1)

  • Group Key: ftrmnt_3.id_faturamento, cntrt_7.id_contrato
92. 0.066 0.634 ↓ 116.0 116 1

Sort (cost=34.22..34.22 rows=1 width=49) (actual time=0.625..0.634 rows=116 loops=1)

  • Sort Key: ftrmnt_3.id_faturamento, cntrt_7.id_contrato
  • Sort Method: quicksort Memory: 34kB
93. 0.032 0.568 ↓ 116.0 116 1

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

94. 0.098 0.420 ↓ 116.0 116 1

Nested Loop (cost=20.77..33.74 rows=1 width=43) (actual time=0.192..0.420 rows=116 loops=1)

95. 0.055 0.205 ↓ 117.0 117 1

Hash Join (cost=20.50..25.41 rows=1 width=28) (actual time=0.172..0.205 rows=117 loops=1)

  • Hash Cond: (cntrt_7.id_contrato = ftrmnt_3.nu_processo_compra)
96. 0.012 0.012 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_7 (cost=0.00..4.38 rows=138 width=20) (actual time=0.004..0.012 rows=103 loops=1)

97. 0.023 0.138 ↓ 117.0 117 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
98. 0.115 0.115 ↓ 122.0 122 1

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

  • 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[])))
  • Rows Removed by Filter: 324
99. 0.117 0.117 ↑ 1.0 1 117

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

  • Index Cond: (id_faturamento = ftrmnt_3.id_faturamento)
100. 0.116 0.116 ↓ 0.0 0 116

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

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

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

  • Group Key: ftrmnt_4.id_faturamento, cntrt_8.id_contrato
102. 0.014 0.043 ↓ 0.0 0 1

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

  • Sort Key: ftrmnt_4.id_faturamento, cntrt_8.id_contrato
  • Sort Method: quicksort Memory: 25kB
103. 0.016 0.029 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_8.id_contrato = ftrmnt_4.nu_processo_compra)
104. 0.006 0.006 ↑ 138.0 1 1

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

105. 0.001 0.007 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
106. 0.000 0.006 ↓ 0.0 0 1

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

107. 0.006 0.006 ↓ 0.0 0 1

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 time=0.006..0.006 rows=0 loops=1)

108. 0.000 0.000 ↓ 0.0 0

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

  • 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.003 0.053 ↓ 0.0 0 1

Materialize (cost=26.42..26.49 rows=2 width=40) (actual time=0.053..0.053 rows=0 loops=1)

110. 0.000 0.050 ↓ 0.0 0 1

GroupAggregate (cost=26.42..26.46 rows=2 width=52) (actual time=0.050..0.050 rows=0 loops=1)

  • Group Key: cntrt_9.id_contrato
111. 0.006 0.050 ↓ 0.0 0 1

Sort (cost=26.42..26.43 rows=2 width=27) (actual time=0.050..0.050 rows=0 loops=1)

  • Sort Key: cntrt_9.id_contrato
  • Sort Method: quicksort Memory: 25kB
112. 0.000 0.044 ↓ 0.0 0 1

Nested Loop (cost=13.94..26.41 rows=2 width=27) (actual time=0.044..0.044 rows=0 loops=1)

113. 0.010 0.044 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_9.id_contrato = trzc_5.id_contrato)
114. 0.004 0.004 ↑ 138.0 1 1

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

115. 0.000 0.030 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
116. 0.030 0.030 ↓ 0.0 0 1

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

  • Filter: (in_situacao = 4)
  • Rows Removed by Filter: 329
117. 0.000 0.000 ↓ 0.0 0

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

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

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

  • Index Cond: (id_autorizacao_faturamento = trzc_5.id_autorizacao_faturamento)
119. 0.007 0.055 ↓ 0.0 0 1

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

120. 0.000 0.048 ↓ 0.0 0 1

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

  • Group Key: cntrt_10.id_contrato
121. 0.006 0.048 ↓ 0.0 0 1

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

  • Sort Key: cntrt_10.id_contrato
  • Sort Method: quicksort Memory: 25kB
122. 0.009 0.042 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_10.id_contrato = trzc_6.id_contrato)
123. 0.003 0.003 ↑ 138.0 1 1

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

124. 0.001 0.030 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
125. 0.029 0.029 ↓ 0.0 0 1

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

  • Filter: (in_situacao = 4)
  • Rows Removed by Filter: 329
126. 0.014 1.550 ↑ 1.3 103 1

Materialize (cost=172.03..174.10 rows=138 width=16) (actual time=1.533..1.550 rows=103 loops=1)

127. 0.050 1.536 ↑ 1.3 103 1

Sort (cost=172.03..172.37 rows=138 width=28) (actual time=1.530..1.536 rows=103 loops=1)

  • Sort Key: tb_cntrt_3.id_contrato, tb_cntrt_3.nu_contrato
  • Sort Method: quicksort Memory: 33kB
128. 0.056 1.486 ↑ 1.3 103 1

Hash Left Join (cost=159.13..167.12 rows=138 width=28) (actual time=1.384..1.486 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_3.id_contrato = tot_recebido_sem_af_nfe.contrato)
129. 0.026 0.831 ↑ 1.3 103 1

Hash Left Join (cost=95.92..101.99 rows=138 width=64) (actual time=0.771..0.831 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_3.id_contrato = tot_recebido_sem_af_nf.contrato)
130. 0.033 0.776 ↑ 1.3 103 1

Hash Left Join (cost=66.49..72.03 rows=138 width=56) (actual time=0.730..0.776 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_3.id_contrato = tot_recebido_af.contrato)
131. 0.027 0.269 ↑ 1.3 103 1

Hash Left Join (cost=32.73..37.64 rows=138 width=24) (actual time=0.240..0.269 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_3.id_contrato = tot_faturado_af_reaj.contrato)
132. 0.016 0.016 ↑ 1.3 103 1

Seq Scan on tb_cntrt tb_cntrt_3 (cost=0.00..4.38 rows=138 width=20) (actual time=0.004..0.016 rows=103 loops=1)

133. 0.006 0.226 ↑ 1.0 1 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
134. 0.001 0.220 ↑ 1.0 1 1

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

135. 0.001 0.219 ↑ 1.0 1 1

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

  • Group Key: cntrt_11.id_contrato
136. 0.018 0.218 ↑ 1.0 1 1

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

  • Sort Key: cntrt_11.id_contrato
  • Sort Method: quicksort Memory: 25kB
137. 0.025 0.200 ↑ 1.0 1 1

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

  • Join Filter: (trzc_7.id_autorizacao_faturamento = ftrmnt_5.id_autorizacao_faturamento)
  • Rows Removed by Join Filter: 183
138. 0.083 0.083 ↓ 18.4 92 1

Seq Scan on tb_ftrmnt ftrmnt_5 (cost=0.00..17.32 rows=5 width=8) (actual time=0.004..0.083 rows=92 loops=1)

  • Filter: (in_situacao_faturamento = ANY ('{9,21}'::bigint[]))
  • Rows Removed by Filter: 354
139. 0.019 0.092 ↑ 1.0 2 92

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

140. 0.019 0.073 ↑ 1.0 2 1

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual time=0.060..0.073 rows=2 loops=1)

  • Hash Cond: (cntrt_11.id_contrato = trzc_7.id_contrato)
141. 0.010 0.010 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_11 (cost=0.00..4.38 rows=138 width=20) (actual time=0.002..0.010 rows=103 loops=1)

142. 0.004 0.044 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
143. 0.040 0.040 ↑ 1.0 2 1

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

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
  • Rows Removed by Filter: 327
144. 0.007 0.474 ↓ 1.6 19 1

Hash (cost=33.60..33.60 rows=12 width=40) (actual time=0.474..0.474 rows=19 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
145. 0.002 0.467 ↓ 1.6 19 1

Subquery Scan on tot_recebido_af (cost=33.06..33.60 rows=12 width=40) (actual time=0.420..0.467 rows=19 loops=1)

146. 0.058 0.465 ↓ 1.6 19 1

GroupAggregate (cost=33.06..33.48 rows=12 width=52) (actual time=0.420..0.465 rows=19 loops=1)

  • Group Key: cntrt_12.id_contrato
147. 0.042 0.407 ↓ 5.6 67 1

Sort (cost=33.06..33.09 rows=12 width=40) (actual time=0.404..0.407 rows=67 loops=1)

  • Sort Key: cntrt_12.id_contrato
  • Sort Method: quicksort Memory: 30kB
148. 0.021 0.365 ↓ 5.6 67 1

Nested Loop (cost=17.81..32.85 rows=12 width=40) (actual time=0.142..0.365 rows=67 loops=1)

  • Join Filter: (ftrmnt_6.id_autorizacao_faturamento = tmtrzc_4.id_autorizacao_faturamento)
149. 0.003 0.268 ↓ 7.6 38 1

Nested Loop (cost=17.53..29.94 rows=5 width=36) (actual time=0.131..0.268 rows=38 loops=1)

150. 0.043 0.189 ↓ 7.6 38 1

Hash Join (cost=17.39..28.84 rows=5 width=24) (actual time=0.113..0.189 rows=38 loops=1)

  • Hash Cond: (trzc_8.id_autorizacao_faturamento = ftrmnt_6.id_autorizacao_faturamento)
151. 0.051 0.051 ↑ 1.1 309 1

Seq Scan on tb_trzc_ftrmnt trzc_8 (cost=0.00..10.09 rows=350 width=16) (actual time=0.005..0.051 rows=309 loops=1)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
  • Rows Removed by Filter: 20
152. 0.011 0.095 ↓ 7.6 38 1

Hash (cost=17.32..17.32 rows=5 width=8) (actual time=0.095..0.095 rows=38 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
153. 0.084 0.084 ↓ 18.4 92 1

Seq Scan on tb_ftrmnt ftrmnt_6 (cost=0.00..17.32 rows=5 width=8) (actual time=0.004..0.084 rows=92 loops=1)

  • Filter: (in_situacao_faturamento = ANY ('{9,21}'::bigint[]))
  • Rows Removed by Filter: 354
154. 0.076 0.076 ↑ 1.0 1 38

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

  • Index Cond: (id_contrato = trzc_8.id_contrato)
155. 0.076 0.076 ↑ 1.5 2 38

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

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
157. 0.000 0.029 ↓ 0.0 0 1

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

158. 0.001 0.029 ↓ 0.0 0 1

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

  • Group Key: cntrt_13.id_contrato
159. 0.005 0.028 ↓ 0.0 0 1

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

  • Sort Key: cntrt_13.id_contrato
  • Sort Method: quicksort Memory: 25kB
160. 0.013 0.023 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_13.id_contrato = ftrmnt_7.nu_processo_compra)
161. 0.004 0.004 ↑ 138.0 1 1

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

162. 0.000 0.006 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
163. 0.000 0.006 ↓ 0.0 0 1

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

164. 0.006 0.006 ↓ 0.0 0 1

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 time=0.006..0.006 rows=0 loops=1)

165. 0.000 0.000 ↓ 0.0 0

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

  • 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.003 0.599 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
167. 0.001 0.596 ↑ 1.0 2 1

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

168. 0.011 0.595 ↑ 1.0 2 1

GroupAggregate (cost=63.13..63.17 rows=2 width=194) (actual time=0.584..0.595 rows=2 loops=1)

  • Group Key: a_1.contrato, a_1.numero_contrato
169. 0.023 0.584 ↓ 26.5 53 1

Sort (cost=63.13..63.13 rows=2 width=194) (actual time=0.582..0.584 rows=53 loops=1)

  • Sort Key: a_1.contrato, a_1.numero_contrato
  • Sort Method: quicksort Memory: 29kB
170. 0.007 0.561 ↓ 26.5 53 1

Subquery Scan on a_1 (cost=63.07..63.12 rows=2 width=194) (actual time=0.541..0.561 rows=53 loops=1)

171. 0.011 0.554 ↓ 26.5 53 1

Unique (cost=63.07..63.10 rows=2 width=202) (actual time=0.540..0.554 rows=53 loops=1)

172. 0.021 0.543 ↓ 26.5 53 1

Sort (cost=63.07..63.08 rows=2 width=202) (actual time=0.540..0.543 rows=53 loops=1)

  • Sort Key: "*SELECT* 1_1".id_faturamento, "*SELECT* 1_1".contrato, "*SELECT* 1_1".numero_contrato, (("*SELECT* 1_1".total_recebido_nf)::double precision)
  • Sort Method: quicksort Memory: 29kB
173. 0.004 0.522 ↓ 26.5 53 1

Append (cost=33.59..63.06 rows=2 width=202) (actual time=0.369..0.522 rows=53 loops=1)

174. 0.030 0.485 ↓ 53.0 53 1

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

175. 0.098 0.455 ↓ 53.0 53 1

GroupAggregate (cost=33.59..33.63 rows=1 width=60) (actual time=0.365..0.455 rows=53 loops=1)

  • Group Key: ftrmnt_8.id_faturamento, cntrt_14.id_contrato
176. 0.032 0.357 ↓ 53.0 53 1

Sort (cost=33.59..33.59 rows=1 width=49) (actual time=0.354..0.357 rows=53 loops=1)

  • Sort Key: ftrmnt_8.id_faturamento, cntrt_14.id_contrato
  • Sort Method: quicksort Memory: 29kB
177. 0.022 0.325 ↓ 53.0 53 1

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

178. 0.041 0.250 ↓ 53.0 53 1

Nested Loop (cost=20.14..33.10 rows=1 width=43) (actual time=0.145..0.250 rows=53 loops=1)

179. 0.035 0.156 ↓ 53.0 53 1

Hash Join (cost=19.87..24.77 rows=1 width=28) (actual time=0.135..0.156 rows=53 loops=1)

  • Hash Cond: (cntrt_14.id_contrato = ftrmnt_8.nu_processo_compra)
180. 0.012 0.012 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_14 (cost=0.00..4.38 rows=138 width=20) (actual time=0.003..0.012 rows=103 loops=1)

181. 0.010 0.109 ↓ 53.0 53 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
182. 0.099 0.099 ↓ 54.0 54 1

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

  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{9,21}'::bigint[])) AND (cd_tipo_faturamento = ANY ('{1,2,3,4}'::bigint[])))
  • Rows Removed by Filter: 392
183. 0.053 0.053 ↑ 1.0 1 53

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

  • Index Cond: (id_faturamento = ftrmnt_8.id_faturamento)
184. 0.053 0.053 ↓ 0.0 0 53

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 time=0.001..0.001 rows=0 loops=53)

  • Index Cond: (id_faturamento = dcmntfscl_1.id_faturamento)
185. 0.001 0.033 ↓ 0.0 0 1

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

  • Group Key: ftrmnt_9.id_faturamento, cntrt_15.id_contrato
186. 0.009 0.032 ↓ 0.0 0 1

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

  • Sort Key: ftrmnt_9.id_faturamento, cntrt_15.id_contrato
  • Sort Method: quicksort Memory: 25kB
187. 0.014 0.023 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_15.id_contrato = ftrmnt_9.nu_processo_compra)
188. 0.003 0.003 ↑ 138.0 1 1

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

189. 0.001 0.006 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
190. 0.000 0.005 ↓ 0.0 0 1

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

191. 0.005 0.005 ↓ 0.0 0 1

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 time=0.005..0.005 rows=0 loops=1)

192. 0.000 0.000 ↓ 0.0 0

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

  • 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.015 0.871 ↑ 1.3 103 1

Materialize (cost=169.86..171.93 rows=138 width=16) (actual time=0.854..0.871 rows=103 loops=1)

194. 0.050 0.856 ↑ 1.3 103 1

Sort (cost=169.86..170.21 rows=138 width=28) (actual time=0.850..0.856 rows=103 loops=1)

  • Sort Key: tb_cntrt_4.id_contrato, tb_cntrt_4.nu_contrato
  • Sort Method: quicksort Memory: 33kB
195. 0.061 0.806 ↑ 1.3 103 1

Hash Left Join (cost=157.02..164.96 rows=138 width=28) (actual time=0.709..0.806 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_4.id_contrato = tot_recebido_sem_af_nfe_1.contrato)
196. 0.028 0.602 ↑ 1.3 103 1

Hash Left Join (cost=93.80..99.83 rows=138 width=64) (actual time=0.544..0.602 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_4.id_contrato = tot_recebido_sem_af_nf_1.contrato)
197. 0.030 0.545 ↑ 1.3 103 1

Hash Left Join (cost=64.37..69.87 rows=138 width=56) (actual time=0.502..0.545 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_4.id_contrato = tot_faturado_af_reaj_1.contrato)
198. 0.027 0.352 ↑ 1.3 103 1

Hash Left Join (cost=31.70..36.67 rows=138 width=52) (actual time=0.323..0.352 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_4.id_contrato = tot_recebido_af_1.contrato)
199. 0.015 0.015 ↑ 1.3 103 1

Seq Scan on tb_cntrt tb_cntrt_4 (cost=0.00..4.38 rows=138 width=20) (actual time=0.003..0.015 rows=103 loops=1)

200. 0.013 0.310 ↑ 1.0 7 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
201. 0.001 0.297 ↑ 1.0 7 1

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

202. 0.029 0.296 ↑ 1.0 7 1

GroupAggregate (cost=31.30..31.54 rows=7 width=52) (actual time=0.279..0.296 rows=7 loops=1)

  • Group Key: cntrt_16.id_contrato
203. 0.021 0.267 ↓ 3.1 22 1

Sort (cost=31.30..31.31 rows=7 width=40) (actual time=0.266..0.267 rows=22 loops=1)

  • Sort Key: cntrt_16.id_contrato
  • Sort Method: quicksort Memory: 26kB
204. 0.008 0.246 ↓ 3.1 22 1

Nested Loop (cost=17.78..31.20 rows=7 width=40) (actual time=0.111..0.246 rows=22 loops=1)

  • Join Filter: (ftrmnt_10.id_autorizacao_faturamento = tmtrzc_5.id_autorizacao_faturamento)
205. 0.001 0.200 ↓ 6.3 19 1

Nested Loop (cost=17.51..29.45 rows=3 width=36) (actual time=0.103..0.200 rows=19 loops=1)

206. 0.035 0.161 ↓ 6.3 19 1

Hash Join (cost=17.36..28.79 rows=3 width=24) (actual time=0.092..0.161 rows=19 loops=1)

  • Hash Cond: (trzc_9.id_autorizacao_faturamento = ftrmnt_10.id_autorizacao_faturamento)
207. 0.050 0.050 ↑ 1.1 309 1

Seq Scan on tb_trzc_ftrmnt trzc_9 (cost=0.00..10.09 rows=350 width=16) (actual time=0.005..0.050 rows=309 loops=1)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
  • Rows Removed by Filter: 20
208. 0.007 0.076 ↓ 6.3 19 1

Hash (cost=17.32..17.32 rows=3 width=8) (actual time=0.076..0.076 rows=19 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
209. 0.069 0.069 ↓ 6.3 19 1

Seq Scan on tb_ftrmnt ftrmnt_10 (cost=0.00..17.32 rows=3 width=8) (actual time=0.022..0.069 rows=19 loops=1)

  • Filter: (in_situacao_faturamento = 22)
  • Rows Removed by Filter: 427
210. 0.038 0.038 ↑ 1.0 1 19

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

  • Index Cond: (id_contrato = trzc_9.id_contrato)
211. 0.038 0.038 ↑ 3.0 1 19

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

  • Index Cond: (id_autorizacao_faturamento = trzc_9.id_autorizacao_faturamento)
212. 0.001 0.163 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
213. 0.000 0.162 ↓ 0.0 0 1

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

214. 0.001 0.162 ↓ 0.0 0 1

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

  • Group Key: cntrt_17.id_contrato
215. 0.005 0.161 ↓ 0.0 0 1

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

  • Sort Key: cntrt_17.id_contrato
  • Sort Method: quicksort Memory: 25kB
216. 0.012 0.156 ↓ 0.0 0 1

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

  • Join Filter: (trzc_10.id_autorizacao_faturamento = ftrmnt_11.id_autorizacao_faturamento)
  • Rows Removed by Join Filter: 38
217. 0.068 0.068 ↓ 6.3 19 1

Seq Scan on tb_ftrmnt ftrmnt_11 (cost=0.00..17.32 rows=3 width=8) (actual time=0.023..0.068 rows=19 loops=1)

  • Filter: (in_situacao_faturamento = 22)
  • Rows Removed by Filter: 427
218. 0.001 0.076 ↑ 1.0 2 19

Materialize (cost=10.11..15.21 rows=2 width=32) (actual time=0.003..0.004 rows=2 loops=19)

219. 0.021 0.075 ↑ 1.0 2 1

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual time=0.062..0.075 rows=2 loops=1)

  • Hash Cond: (cntrt_17.id_contrato = trzc_10.id_contrato)
220. 0.012 0.012 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_17 (cost=0.00..4.38 rows=138 width=20) (actual time=0.004..0.012 rows=103 loops=1)

221. 0.003 0.042 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
222. 0.039 0.039 ↑ 1.0 2 1

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

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
224. 0.000 0.029 ↓ 0.0 0 1

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

225. 0.001 0.029 ↓ 0.0 0 1

GroupAggregate (cost=29.39..29.41 rows=1 width=28) (actual time=0.028..0.029 rows=0 loops=1)

  • Group Key: cntrt_18.id_contrato
226. 0.006 0.028 ↓ 0.0 0 1

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

  • Sort Key: cntrt_18.id_contrato
  • Sort Method: quicksort Memory: 25kB
227. 0.010 0.022 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_18.id_contrato = ftrmnt_12.nu_processo_compra)
228. 0.003 0.003 ↑ 138.0 1 1

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

229. 0.000 0.009 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
230. 0.000 0.009 ↓ 0.0 0 1

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

231. 0.009 0.009 ↓ 0.0 0 1

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 time=0.009..0.009 rows=0 loops=1)

232. 0.000 0.000 ↓ 0.0 0

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

  • 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.143 ↓ 0.0 0 1

Hash (cost=63.19..63.19 rows=2 width=16) (actual time=0.143..0.143 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
234. 0.000 0.143 ↓ 0.0 0 1

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

235. 0.001 0.143 ↓ 0.0 0 1

GroupAggregate (cost=63.13..63.17 rows=2 width=194) (actual time=0.143..0.143 rows=0 loops=1)

  • Group Key: a_2.contrato, a_2.numero_contrato
236. 0.007 0.142 ↓ 0.0 0 1

Sort (cost=63.13..63.13 rows=2 width=194) (actual time=0.142..0.142 rows=0 loops=1)

  • Sort Key: a_2.contrato, a_2.numero_contrato
  • Sort Method: quicksort Memory: 25kB
237. 0.000 0.135 ↓ 0.0 0 1

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

238. 0.001 0.135 ↓ 0.0 0 1

Unique (cost=63.07..63.10 rows=2 width=202) (actual time=0.135..0.135 rows=0 loops=1)

239. 0.005 0.134 ↓ 0.0 0 1

Sort (cost=63.07..63.08 rows=2 width=202) (actual time=0.134..0.134 rows=0 loops=1)

  • Sort Key: "*SELECT* 1_2".id_faturamento, "*SELECT* 1_2".contrato, "*SELECT* 1_2".numero_contrato, (("*SELECT* 1_2".total_recebido_nf)::double precision)
  • Sort Method: quicksort Memory: 25kB
240. 0.001 0.129 ↓ 0.0 0 1

Append (cost=33.59..63.06 rows=2 width=202) (actual time=0.129..0.129 rows=0 loops=1)

241. 0.000 0.103 ↓ 0.0 0 1

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

242. 0.001 0.103 ↓ 0.0 0 1

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

  • Group Key: ftrmnt_13.id_faturamento, cntrt_19.id_contrato
243. 0.007 0.102 ↓ 0.0 0 1

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

  • Sort Key: ftrmnt_13.id_faturamento, cntrt_19.id_contrato
  • Sort Method: quicksort Memory: 25kB
244. 0.000 0.095 ↓ 0.0 0 1

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

245. 0.000 0.095 ↓ 0.0 0 1

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

246. 0.014 0.095 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_19.id_contrato = ftrmnt_13.nu_processo_compra)
247. 0.003 0.003 ↑ 138.0 1 1

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

248. 0.001 0.078 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
249. 0.077 0.077 ↓ 0.0 0 1

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

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

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

  • Index Cond: (id_faturamento = ftrmnt_13.id_faturamento)
251. 0.000 0.000 ↓ 0.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) (never executed)

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

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

  • Group Key: ftrmnt_14.id_faturamento, cntrt_20.id_contrato
253. 0.006 0.025 ↓ 0.0 0 1

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

  • Sort Key: ftrmnt_14.id_faturamento, cntrt_20.id_contrato
  • Sort Method: quicksort Memory: 25kB
254. 0.009 0.019 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_20.id_contrato = ftrmnt_14.nu_processo_compra)
255. 0.003 0.003 ↑ 138.0 1 1

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

256. 0.000 0.007 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
257. 0.000 0.007 ↓ 0.0 0 1

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

258. 0.007 0.007 ↓ 0.0 0 1

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 time=0.007..0.007 rows=0 loops=1)

259. 0.000 0.000 ↓ 0.0 0

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

  • 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.015 2.911 ↑ 1.3 103 1

Materialize (cost=182.47..184.54 rows=138 width=16) (actual time=2.892..2.911 rows=103 loops=1)

261. 0.048 2.896 ↑ 1.3 103 1

Sort (cost=182.47..182.81 rows=138 width=28) (actual time=2.889..2.896 rows=103 loops=1)

  • Sort Key: tb_cntrt_5.id_contrato, tb_cntrt_5.nu_contrato
  • Sort Method: quicksort Memory: 33kB
262. 0.088 2.848 ↑ 1.3 103 1

Hash Left Join (cost=168.26..177.56 rows=138 width=28) (actual time=2.666..2.848 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_5.id_contrato = tot_recebido_sem_af_nfe_2.contrato)
263. 0.028 2.080 ↑ 1.3 103 1

Hash Left Join (cost=105.05..111.74 rows=138 width=67) (actual time=1.969..2.080 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_5.id_contrato = tot_recebido_sem_af_nf_2.contrato)
264. 0.034 2.024 ↑ 1.3 103 1

Hash Left Join (cost=75.62..81.78 rows=138 width=59) (actual time=1.928..2.024 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_5.id_contrato = tot_recebido_af_2.contrato)
265. 0.027 0.462 ↑ 1.3 103 1

Hash Left Join (cost=41.86..47.39 rows=138 width=27) (actual time=0.386..0.462 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_5.id_contrato = tot_faturado_af_reaj_2.contrato)
266. 0.039 0.160 ↑ 1.3 103 1

Hash Right Join (cost=9.13..14.13 rows=138 width=23) (actual time=0.100..0.160 rows=103 loops=1)

  • Hash Cond: (cntrt_21.id_contrato = tb_cntrt_5.id_contrato)
267. 0.036 0.084 ↓ 1.1 101 1

Hash Join (cost=3.02..7.78 rows=90 width=11) (actual time=0.048..0.084 rows=101 loops=1)

  • Hash Cond: (cntrt_21.id_contrato = pre_2.id_contrato)
268. 0.014 0.014 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_21 (cost=0.00..4.38 rows=138 width=8) (actual time=0.002..0.014 rows=103 loops=1)

269. 0.019 0.034 ↓ 1.1 101 1

Hash (cost=1.90..1.90 rows=90 width=11) (actual time=0.034..0.034 rows=101 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
270. 0.015 0.015 ↓ 1.1 101 1

Seq Scan on tb_vl_tlzd_pr_vtr pre_2 (cost=0.00..1.90 rows=90 width=11) (actual time=0.005..0.015 rows=101 loops=1)

271. 0.020 0.037 ↑ 1.3 103 1

Hash (cost=4.38..4.38 rows=138 width=20) (actual time=0.037..0.037 rows=103 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
272. 0.017 0.017 ↑ 1.3 103 1

Seq Scan on tb_cntrt tb_cntrt_5 (cost=0.00..4.38 rows=138 width=20) (actual time=0.004..0.017 rows=103 loops=1)

273. 0.000 0.275 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
274. 0.000 0.275 ↓ 0.0 0 1

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

275. 0.001 0.275 ↓ 0.0 0 1

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

  • Group Key: cntrt_22.id_contrato
276. 0.005 0.274 ↓ 0.0 0 1

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

  • Sort Key: cntrt_22.id_contrato
  • Sort Method: quicksort Memory: 25kB
277. 0.177 0.269 ↓ 0.0 0 1

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

  • Join Filter: (trzc_11.id_autorizacao_faturamento = ftrmnt_15.id_autorizacao_faturamento)
  • Rows Removed by Join Filter: 492
278. 0.092 0.092 ↓ 49.2 246 1

Seq Scan on tb_ftrmnt ftrmnt_15 (cost=0.00..17.32 rows=5 width=8) (actual time=0.005..0.092 rows=246 loops=1)

  • Filter: (in_situacao_faturamento = ANY ('{12,13}'::bigint[]))
  • Rows Removed by Filter: 200
279. 0.000 0.000 ↑ 1.0 2 246

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

280. 0.022 0.074 ↑ 1.0 2 1

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual time=0.061..0.074 rows=2 loops=1)

  • Hash Cond: (cntrt_22.id_contrato = trzc_11.id_contrato)
281. 0.011 0.011 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_22 (cost=0.00..4.38 rows=138 width=20) (actual time=0.003..0.011 rows=103 loops=1)

282. 0.003 0.041 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
283. 0.038 0.038 ↑ 1.0 2 1

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

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
  • Rows Removed by Filter: 327
284. 0.018 1.528 ↓ 4.4 53 1

Hash (cost=33.60..33.60 rows=12 width=40) (actual time=1.528..1.528 rows=53 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
285. 0.007 1.510 ↓ 4.4 53 1

Subquery Scan on tot_recebido_af_2 (cost=33.06..33.60 rows=12 width=40) (actual time=1.258..1.510 rows=53 loops=1)

286. 0.238 1.503 ↓ 4.4 53 1

GroupAggregate (cost=33.06..33.48 rows=12 width=52) (actual time=1.257..1.503 rows=53 loops=1)

  • Group Key: cntrt_23.id_contrato
287. 0.211 1.265 ↓ 42.9 515 1

Sort (cost=33.06..33.09 rows=12 width=40) (actual time=1.242..1.265 rows=515 loops=1)

  • Sort Key: cntrt_23.id_contrato
  • Sort Method: quicksort Memory: 65kB
288. 0.133 1.054 ↓ 42.9 515 1

Nested Loop (cost=17.81..32.85 rows=12 width=40) (actual time=0.168..1.054 rows=515 loops=1)

  • Join Filter: (ftrmnt_16.id_autorizacao_faturamento = tmtrzc_6.id_autorizacao_faturamento)
289. 0.098 0.557 ↓ 36.4 182 1

Nested Loop (cost=17.53..29.94 rows=5 width=36) (actual time=0.158..0.557 rows=182 loops=1)

290. 0.076 0.277 ↓ 36.4 182 1

Hash Join (cost=17.39..28.84 rows=5 width=24) (actual time=0.149..0.277 rows=182 loops=1)

  • Hash Cond: (trzc_12.id_autorizacao_faturamento = ftrmnt_16.id_autorizacao_faturamento)
291. 0.066 0.066 ↑ 1.1 309 1

Seq Scan on tb_trzc_ftrmnt trzc_12 (cost=0.00..10.09 rows=350 width=16) (actual time=0.004..0.066 rows=309 loops=1)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
  • Rows Removed by Filter: 20
292. 0.031 0.135 ↓ 36.4 182 1

Hash (cost=17.32..17.32 rows=5 width=8) (actual time=0.135..0.135 rows=182 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
293. 0.104 0.104 ↓ 49.2 246 1

Seq Scan on tb_ftrmnt ftrmnt_16 (cost=0.00..17.32 rows=5 width=8) (actual time=0.004..0.104 rows=246 loops=1)

  • Filter: (in_situacao_faturamento = ANY ('{12,13}'::bigint[]))
  • Rows Removed by Filter: 200
294. 0.182 0.182 ↑ 1.0 1 182

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

  • Index Cond: (id_contrato = trzc_12.id_contrato)
295. 0.364 0.364 ↑ 1.0 3 182

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

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
297. 0.001 0.028 ↓ 0.0 0 1

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

298. 0.000 0.027 ↓ 0.0 0 1

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

  • Group Key: cntrt_24.id_contrato
299. 0.008 0.027 ↓ 0.0 0 1

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

  • Sort Key: cntrt_24.id_contrato
  • Sort Method: quicksort Memory: 25kB
300. 0.009 0.019 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_24.id_contrato = ftrmnt_17.nu_processo_compra)
301. 0.004 0.004 ↑ 138.0 1 1

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

302. 0.000 0.006 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
303. 0.001 0.006 ↓ 0.0 0 1

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

304. 0.005 0.005 ↓ 0.0 0 1

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 time=0.005..0.005 rows=0 loops=1)

305. 0.000 0.000 ↓ 0.0 0

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

  • 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.006 0.680 ↑ 2.0 1 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
307. 0.001 0.674 ↑ 2.0 1 1

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

308. 0.012 0.673 ↑ 2.0 1 1

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

  • Group Key: a_3.contrato, a_3.numero_contrato
309. 0.027 0.661 ↓ 31.5 63 1

Sort (cost=63.13..63.13 rows=2 width=194) (actual time=0.659..0.661 rows=63 loops=1)

  • Sort Key: a_3.contrato, a_3.numero_contrato
  • Sort Method: quicksort Memory: 29kB
310. 0.008 0.634 ↓ 31.5 63 1

Subquery Scan on a_3 (cost=63.07..63.12 rows=2 width=194) (actual time=0.608..0.634 rows=63 loops=1)

311. 0.016 0.626 ↓ 31.5 63 1

Unique (cost=63.07..63.10 rows=2 width=202) (actual time=0.607..0.626 rows=63 loops=1)

312. 0.035 0.610 ↓ 31.5 63 1

Sort (cost=63.07..63.08 rows=2 width=202) (actual time=0.607..0.610 rows=63 loops=1)

  • Sort Key: "*SELECT* 1_3".id_faturamento, "*SELECT* 1_3".contrato, "*SELECT* 1_3".numero_contrato, (("*SELECT* 1_3".total_recebido_nf)::double precision)
  • Sort Method: quicksort Memory: 29kB
313. 0.006 0.575 ↓ 31.5 63 1

Append (cost=33.59..63.06 rows=2 width=202) (actual time=0.399..0.575 rows=63 loops=1)

314. 0.036 0.539 ↓ 63.0 63 1

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

315. 0.112 0.503 ↓ 63.0 63 1

GroupAggregate (cost=33.59..33.63 rows=1 width=60) (actual time=0.393..0.503 rows=63 loops=1)

  • Group Key: ftrmnt_18.id_faturamento, cntrt_25.id_contrato
316. 0.049 0.391 ↓ 63.0 63 1

Sort (cost=33.59..33.59 rows=1 width=49) (actual time=0.380..0.391 rows=63 loops=1)

  • Sort Key: ftrmnt_18.id_faturamento, cntrt_25.id_contrato
  • Sort Method: quicksort Memory: 29kB
317. 0.016 0.342 ↓ 63.0 63 1

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

318. 0.049 0.263 ↓ 63.0 63 1

Nested Loop (cost=20.14..33.10 rows=1 width=43) (actual time=0.141..0.263 rows=63 loops=1)

319. 0.037 0.151 ↓ 63.0 63 1

Hash Join (cost=19.87..24.77 rows=1 width=28) (actual time=0.132..0.151 rows=63 loops=1)

  • Hash Cond: (cntrt_25.id_contrato = ftrmnt_18.nu_processo_compra)
320. 0.011 0.011 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_25 (cost=0.00..4.38 rows=138 width=20) (actual time=0.003..0.011 rows=103 loops=1)

321. 0.012 0.103 ↓ 63.0 63 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
322. 0.091 0.091 ↓ 64.0 64 1

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

  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{12,13}'::bigint[])) AND (cd_tipo_faturamento = ANY ('{1,2,3,4}'::bigint[])))
  • Rows Removed by Filter: 382
323. 0.063 0.063 ↑ 1.0 1 63

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

  • Index Cond: (id_faturamento = ftrmnt_18.id_faturamento)
324. 0.063 0.063 ↓ 0.0 0 63

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 time=0.001..0.001 rows=0 loops=63)

  • Index Cond: (id_faturamento = dcmntfscl_3.id_faturamento)
325. 0.001 0.030 ↓ 0.0 0 1

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

  • Group Key: ftrmnt_19.id_faturamento, cntrt_26.id_contrato
326. 0.011 0.029 ↓ 0.0 0 1

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

  • Sort Key: ftrmnt_19.id_faturamento, cntrt_26.id_contrato
  • Sort Method: quicksort Memory: 25kB
327. 0.008 0.018 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_26.id_contrato = ftrmnt_19.nu_processo_compra)
328. 0.004 0.004 ↑ 138.0 1 1

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

329. 0.001 0.006 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
330. 0.000 0.005 ↓ 0.0 0 1

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

331. 0.005 0.005 ↓ 0.0 0 1

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 time=0.005..0.005 rows=0 loops=1)

332. 0.000 0.000 ↓ 0.0 0

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

  • 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.017 0.100 ↓ 1.1 101 1

Hash (cost=7.78..7.78 rows=90 width=11) (actual time=0.100..0.100 rows=101 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
334. 0.039 0.083 ↓ 1.1 101 1

Hash Join (cost=3.02..7.78 rows=90 width=11) (actual time=0.052..0.083 rows=101 loops=1)

  • Hash Cond: (cntrt_4.id_contrato = pre_1.id_contrato)
335. 0.013 0.013 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_4 (cost=0.00..4.38 rows=138 width=8) (actual time=0.004..0.013 rows=103 loops=1)

336. 0.017 0.031 ↓ 1.1 101 1

Hash (cost=1.90..1.90 rows=90 width=11) (actual time=0.031..0.031 rows=101 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
337. 0.014 0.014 ↓ 1.1 101 1

Seq Scan on tb_vl_tlzd_pr_vtr pre_1 (cost=0.00..1.90 rows=90 width=11) (actual time=0.004..0.014 rows=101 loops=1)

338. 0.016 2.485 ↑ 1.3 103 1

Materialize (cost=223.98..226.05 rows=138 width=40) (actual time=2.464..2.485 rows=103 loops=1)

339. 0.048 2.469 ↑ 1.3 103 1

Sort (cost=223.98..224.33 rows=138 width=52) (actual time=2.461..2.469 rows=103 loops=1)

  • Sort Key: tb_cntrt_6.id_contrato, tb_cntrt_6.nu_contrato
  • Sort Method: quicksort Memory: 32kB
340. 0.047 2.421 ↑ 1.3 103 1

Hash Left Join (cost=213.36..219.08 rows=138 width=52) (actual time=2.362..2.421 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_6.id_contrato = tot_comprometido_homologado.contrato)
341. 0.058 1.462 ↑ 1.3 103 1

Hash Right Join (cost=108.56..112.04 rows=138 width=52) (actual time=1.433..1.462 rows=103 loops=1)

  • Hash Cond: (cntrt_27.id_contrato = tb_cntrt_6.id_contrato)
342. 0.184 1.365 ↑ 4.5 31 1

HashAggregate (cost=102.46..104.18 rows=138 width=52) (actual time=1.353..1.365 rows=31 loops=1)

  • Group Key: cntrt_27.id_contrato
343. 0.131 1.181 ↓ 2.7 620 1

Hash Join (cost=47.13..101.32 rows=228 width=27) (actual time=0.421..1.181 rows=620 loops=1)

  • Hash Cond: (rdm.id_contrato = cntrt_27.id_contrato)
344. 0.122 1.012 ↓ 2.7 620 1

Hash Join (cost=41.03..94.59 rows=228 width=15) (actual time=0.371..1.012 rows=620 loops=1)

  • Hash Cond: (fas.id_ordem_servico = rdm.id_ordem_servico)
345. 0.332 0.773 ↓ 1.9 620 1

Hash Join (cost=27.95..80.67 rows=318 width=23) (actual time=0.239..0.773 rows=620 loops=1)

  • Hash Cond: ((rdmtm.id_ordem_servico = fas.id_ordem_servico) AND (rdmtm.nu_fase = fas.nu_fase))
346. 0.264 0.264 ↑ 1.0 1,416 1

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

  • Filter: (id_autorizacao_faturamento IS NULL)
  • Rows Removed by Filter: 516
347. 0.017 0.177 ↑ 1.0 86 1

Hash (cost=26.63..26.63 rows=88 width=10) (actual time=0.177..0.177 rows=86 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
348. 0.160 0.160 ↑ 1.0 86 1

Seq Scan on tb_fs_rdm_srvc fas (cost=0.00..26.63 rows=88 width=10) (actual time=0.019..0.160 rows=86 loops=1)

  • Filter: (in_situacao_os = ANY ('{2,3,6,7,8,D,A}'::bpchar[]))
  • Rows Removed by Filter: 317
349. 0.033 0.117 ↓ 1.1 227 1

Hash (cost=10.54..10.54 rows=203 width=16) (actual time=0.117..0.117 rows=227 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
350. 0.084 0.084 ↓ 1.1 227 1

Seq Scan on tb_rdm_srvc rdm (cost=0.00..10.54 rows=203 width=16) (actual time=0.008..0.084 rows=227 loops=1)

  • Filter: (in_situacao_os = ANY ('{2,3}'::bpchar[]))
  • Rows Removed by Filter: 75
351. 0.022 0.038 ↑ 1.3 103 1

Hash (cost=4.38..4.38 rows=138 width=20) (actual time=0.038..0.038 rows=103 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
352. 0.016 0.016 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_27 (cost=0.00..4.38 rows=138 width=20) (actual time=0.003..0.016 rows=103 loops=1)

353. 0.020 0.039 ↑ 1.3 103 1

Hash (cost=4.38..4.38 rows=138 width=20) (actual time=0.039..0.039 rows=103 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
354. 0.019 0.019 ↑ 1.3 103 1

Seq Scan on tb_cntrt tb_cntrt_6 (cost=0.00..4.38 rows=138 width=20) (actual time=0.006..0.019 rows=103 loops=1)

355. 0.007 0.912 ↑ 6.9 20 1

Hash (cost=103.07..103.07 rows=138 width=40) (actual time=0.912..0.912 rows=20 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
356. 0.002 0.905 ↑ 6.9 20 1

Subquery Scan on tot_comprometido_homologado (cost=99.96..103.07 rows=138 width=40) (actual time=0.895..0.905 rows=20 loops=1)

357. 0.107 0.903 ↑ 6.9 20 1

HashAggregate (cost=99.96..101.69 rows=138 width=52) (actual time=0.894..0.903 rows=20 loops=1)

  • Group Key: cntrt_28.id_contrato
358. 0.065 0.796 ↓ 1.2 280 1

Hash Join (cost=44.60..98.81 rows=231 width=27) (actual time=0.268..0.796 rows=280 loops=1)

  • Hash Cond: (rdm_1.id_contrato = cntrt_28.id_contrato)
359. 0.063 0.694 ↓ 1.2 280 1

Hash Join (cost=38.50..92.08 rows=231 width=15) (actual time=0.220..0.694 rows=280 loops=1)

  • Hash Cond: (fas_1.id_ordem_servico = rdm_1.id_ordem_servico)
360. 0.238 0.517 ↑ 1.1 280 1

Hash Join (cost=25.42..78.14 rows=322 width=23) (actual time=0.094..0.517 rows=280 loops=1)

  • Hash Cond: ((rdmtm_1.id_ordem_servico = fas_1.id_ordem_servico) AND (rdmtm_1.nu_fase = fas_1.nu_fase))
361. 0.201 0.201 ↑ 1.0 1,416 1

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

  • Filter: (id_autorizacao_faturamento IS NULL)
  • Rows Removed by Filter: 516
362. 0.016 0.078 ↑ 1.1 81 1

Hash (cost=24.09..24.09 rows=89 width=10) (actual time=0.078..0.078 rows=81 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
363. 0.062 0.062 ↑ 1.1 81 1

Seq Scan on tb_fs_rdm_srvc fas_1 (cost=0.00..24.09 rows=89 width=10) (actual time=0.004..0.062 rows=81 loops=1)

  • Filter: (in_situacao_os = '4'::bpchar)
  • Rows Removed by Filter: 322
364. 0.037 0.114 ↓ 1.1 227 1

Hash (cost=10.54..10.54 rows=203 width=16) (actual time=0.114..0.114 rows=227 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
365. 0.077 0.077 ↓ 1.1 227 1

Seq Scan on tb_rdm_srvc rdm_1 (cost=0.00..10.54 rows=203 width=16) (actual time=0.016..0.077 rows=227 loops=1)

  • Filter: (in_situacao_os = ANY ('{2,3}'::bpchar[]))
  • Rows Removed by Filter: 75
366. 0.020 0.037 ↑ 1.3 103 1

Hash (cost=4.38..4.38 rows=138 width=20) (actual time=0.037..0.037 rows=103 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
367. 0.017 0.017 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_28 (cost=0.00..4.38 rows=138 width=20) (actual time=0.004..0.017 rows=103 loops=1)

368. 0.023 1.639 ↑ 1.3 103 1

Materialize (cost=172.03..174.10 rows=138 width=16) (actual time=1.621..1.639 rows=103 loops=1)

369. 0.047 1.616 ↑ 1.3 103 1

Sort (cost=172.03..172.37 rows=138 width=28) (actual time=1.609..1.616 rows=103 loops=1)

  • Sort Key: tb_cntrt_7.id_contrato, tb_cntrt_7.nu_contrato
  • Sort Method: quicksort Memory: 33kB
370. 0.060 1.569 ↑ 1.3 103 1

Hash Left Join (cost=159.13..167.12 rows=138 width=28) (actual time=1.457..1.569 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_7.id_contrato = tot_recebido_sem_af_nfe_3.contrato)
371. 0.025 0.865 ↑ 1.3 103 1

Hash Left Join (cost=95.92..101.99 rows=138 width=64) (actual time=0.797..0.865 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_7.id_contrato = tot_recebido_sem_af_nf_3.contrato)
372. 0.035 0.806 ↑ 1.3 103 1

Hash Left Join (cost=66.49..72.03 rows=138 width=56) (actual time=0.752..0.806 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_7.id_contrato = tot_recebido_af_3.contrato)
373. 0.038 0.292 ↑ 1.3 103 1

Hash Left Join (cost=32.73..37.64 rows=138 width=24) (actual time=0.262..0.292 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_7.id_contrato = tot_faturado_af_reaj_3.contrato)
374. 0.015 0.015 ↑ 1.3 103 1

Seq Scan on tb_cntrt tb_cntrt_7 (cost=0.00..4.38 rows=138 width=20) (actual time=0.004..0.015 rows=103 loops=1)

375. 0.005 0.239 ↑ 1.0 1 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
376. 0.000 0.234 ↑ 1.0 1 1

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

377. 0.005 0.234 ↑ 1.0 1 1

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

  • Group Key: cntrt_29.id_contrato
378. 0.011 0.229 ↑ 1.0 1 1

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

  • Sort Key: cntrt_29.id_contrato
  • Sort Method: quicksort Memory: 25kB
379. 0.032 0.218 ↑ 1.0 1 1

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

  • Join Filter: (trzc_13.id_autorizacao_faturamento = ftrmnt_20.id_autorizacao_faturamento)
  • Rows Removed by Join Filter: 183
380. 0.094 0.094 ↓ 18.4 92 1

Seq Scan on tb_ftrmnt ftrmnt_20 (cost=0.00..17.32 rows=5 width=8) (actual time=0.004..0.094 rows=92 loops=1)

  • Filter: (in_situacao_faturamento = ANY ('{9,21}'::bigint[]))
  • Rows Removed by Filter: 354
381. 0.011 0.092 ↑ 1.0 2 92

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

382. 0.024 0.081 ↑ 1.0 2 1

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual time=0.068..0.081 rows=2 loops=1)

  • Hash Cond: (cntrt_29.id_contrato = trzc_13.id_contrato)
383. 0.010 0.010 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_29 (cost=0.00..4.38 rows=138 width=20) (actual time=0.002..0.010 rows=103 loops=1)

384. 0.006 0.047 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
385. 0.041 0.041 ↑ 1.0 2 1

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

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
  • Rows Removed by Filter: 327
386. 0.007 0.479 ↓ 1.6 19 1

Hash (cost=33.60..33.60 rows=12 width=40) (actual time=0.479..0.479 rows=19 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
387. 0.003 0.472 ↓ 1.6 19 1

Subquery Scan on tot_recebido_af_3 (cost=33.06..33.60 rows=12 width=40) (actual time=0.424..0.472 rows=19 loops=1)

388. 0.059 0.469 ↓ 1.6 19 1

GroupAggregate (cost=33.06..33.48 rows=12 width=52) (actual time=0.423..0.469 rows=19 loops=1)

  • Group Key: cntrt_30.id_contrato
389. 0.041 0.410 ↓ 5.6 67 1

Sort (cost=33.06..33.09 rows=12 width=40) (actual time=0.407..0.410 rows=67 loops=1)

  • Sort Key: cntrt_30.id_contrato
  • Sort Method: quicksort Memory: 30kB
390. 0.020 0.369 ↓ 5.6 67 1

Nested Loop (cost=17.81..32.85 rows=12 width=40) (actual time=0.139..0.369 rows=67 loops=1)

  • Join Filter: (ftrmnt_21.id_autorizacao_faturamento = tmtrzc_7.id_autorizacao_faturamento)
391. 0.032 0.273 ↓ 7.6 38 1

Nested Loop (cost=17.53..29.94 rows=5 width=36) (actual time=0.128..0.273 rows=38 loops=1)

392. 0.047 0.203 ↓ 7.6 38 1

Hash Join (cost=17.39..28.84 rows=5 width=24) (actual time=0.118..0.203 rows=38 loops=1)

  • Hash Cond: (trzc_14.id_autorizacao_faturamento = ftrmnt_21.id_autorizacao_faturamento)
393. 0.059 0.059 ↑ 1.1 309 1

Seq Scan on tb_trzc_ftrmnt trzc_14 (cost=0.00..10.09 rows=350 width=16) (actual time=0.005..0.059 rows=309 loops=1)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
  • Rows Removed by Filter: 20
394. 0.012 0.097 ↓ 7.6 38 1

Hash (cost=17.32..17.32 rows=5 width=8) (actual time=0.097..0.097 rows=38 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
395. 0.085 0.085 ↓ 18.4 92 1

Seq Scan on tb_ftrmnt ftrmnt_21 (cost=0.00..17.32 rows=5 width=8) (actual time=0.004..0.085 rows=92 loops=1)

  • Filter: (in_situacao_faturamento = ANY ('{9,21}'::bigint[]))
  • Rows Removed by Filter: 354
396. 0.038 0.038 ↑ 1.0 1 38

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

  • Index Cond: (id_contrato = trzc_14.id_contrato)
397. 0.076 0.076 ↑ 1.5 2 38

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

  • Index Cond: (id_autorizacao_faturamento = trzc_14.id_autorizacao_faturamento)
398. 0.001 0.034 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
399. 0.000 0.033 ↓ 0.0 0 1

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

400. 0.001 0.033 ↓ 0.0 0 1

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

  • Group Key: cntrt_31.id_contrato
401. 0.008 0.032 ↓ 0.0 0 1

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

  • Sort Key: cntrt_31.id_contrato
  • Sort Method: quicksort Memory: 25kB
402. 0.010 0.024 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_31.id_contrato = ftrmnt_22.nu_processo_compra)
403. 0.003 0.003 ↑ 138.0 1 1

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

404. 0.000 0.011 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
405. 0.000 0.011 ↓ 0.0 0 1

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

406. 0.011 0.011 ↓ 0.0 0 1

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 time=0.011..0.011 rows=0 loops=1)

407. 0.000 0.000 ↓ 0.0 0

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

  • 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.003 0.644 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
409. 0.001 0.641 ↑ 1.0 2 1

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

410. 0.011 0.640 ↑ 1.0 2 1

GroupAggregate (cost=63.13..63.17 rows=2 width=194) (actual time=0.630..0.640 rows=2 loops=1)

  • Group Key: a_4.contrato, a_4.numero_contrato
411. 0.029 0.629 ↓ 26.5 53 1

Sort (cost=63.13..63.13 rows=2 width=194) (actual time=0.627..0.629 rows=53 loops=1)

  • Sort Key: a_4.contrato, a_4.numero_contrato
  • Sort Method: quicksort Memory: 29kB
412. 0.007 0.600 ↓ 26.5 53 1

Subquery Scan on a_4 (cost=63.07..63.12 rows=2 width=194) (actual time=0.569..0.600 rows=53 loops=1)

413. 0.022 0.593 ↓ 26.5 53 1

Unique (cost=63.07..63.10 rows=2 width=202) (actual time=0.569..0.593 rows=53 loops=1)

414. 0.030 0.571 ↓ 26.5 53 1

Sort (cost=63.07..63.08 rows=2 width=202) (actual time=0.568..0.571 rows=53 loops=1)

  • Sort Key: "*SELECT* 1_4".id_faturamento, "*SELECT* 1_4".contrato, "*SELECT* 1_4".numero_contrato, (("*SELECT* 1_4".total_recebido_nf)::double precision)
  • Sort Method: quicksort Memory: 29kB
415. 0.005 0.541 ↓ 26.5 53 1

Append (cost=33.59..63.06 rows=2 width=202) (actual time=0.384..0.541 rows=53 loops=1)

416. 0.030 0.501 ↓ 53.0 53 1

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

417. 0.109 0.471 ↓ 53.0 53 1

GroupAggregate (cost=33.59..33.63 rows=1 width=60) (actual time=0.380..0.471 rows=53 loops=1)

  • Group Key: ftrmnt_23.id_faturamento, cntrt_32.id_contrato
418. 0.041 0.362 ↓ 53.0 53 1

Sort (cost=33.59..33.59 rows=1 width=49) (actual time=0.358..0.362 rows=53 loops=1)

  • Sort Key: ftrmnt_23.id_faturamento, cntrt_32.id_contrato
  • Sort Method: quicksort Memory: 29kB
419. 0.024 0.321 ↓ 53.0 53 1

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

420. 0.042 0.244 ↓ 53.0 53 1

Nested Loop (cost=20.14..33.10 rows=1 width=43) (actual time=0.139..0.244 rows=53 loops=1)

421. 0.035 0.149 ↓ 53.0 53 1

Hash Join (cost=19.87..24.77 rows=1 width=28) (actual time=0.128..0.149 rows=53 loops=1)

  • Hash Cond: (cntrt_32.id_contrato = ftrmnt_23.nu_processo_compra)
422. 0.012 0.012 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_32 (cost=0.00..4.38 rows=138 width=20) (actual time=0.003..0.012 rows=103 loops=1)

423. 0.011 0.102 ↓ 53.0 53 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
424. 0.091 0.091 ↓ 54.0 54 1

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

  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{9,21}'::bigint[])) AND (cd_tipo_faturamento = ANY ('{1,2,3,4}'::bigint[])))
  • Rows Removed by Filter: 392
425. 0.053 0.053 ↑ 1.0 1 53

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

  • Index Cond: (id_faturamento = ftrmnt_23.id_faturamento)
426. 0.053 0.053 ↓ 0.0 0 53

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 time=0.001..0.001 rows=0 loops=53)

  • Index Cond: (id_faturamento = dcmntfscl_4.id_faturamento)
427. 0.001 0.035 ↓ 0.0 0 1

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

  • Group Key: ftrmnt_24.id_faturamento, cntrt_33.id_contrato
428. 0.013 0.034 ↓ 0.0 0 1

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

  • Sort Key: ftrmnt_24.id_faturamento, cntrt_33.id_contrato
  • Sort Method: quicksort Memory: 25kB
429. 0.010 0.021 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_33.id_contrato = ftrmnt_24.nu_processo_compra)
430. 0.004 0.004 ↑ 138.0 1 1

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

431. 0.000 0.007 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
432. 0.001 0.007 ↓ 0.0 0 1

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

433. 0.006 0.006 ↓ 0.0 0 1

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 time=0.006..0.006 rows=0 loops=1)

434. 0.000 0.000 ↓ 0.0 0

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

  • 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.018 0.886 ↑ 1.3 103 1

Materialize (cost=169.86..171.93 rows=138 width=16) (actual time=0.867..0.886 rows=103 loops=1)

436. 0.043 0.868 ↑ 1.3 103 1

Sort (cost=169.86..170.21 rows=138 width=28) (actual time=0.862..0.868 rows=103 loops=1)

  • Sort Key: tb_cntrt_8.id_contrato, tb_cntrt_8.nu_contrato
  • Sort Method: quicksort Memory: 33kB
437. 0.053 0.825 ↑ 1.3 103 1

Hash Left Join (cost=157.02..164.96 rows=138 width=28) (actual time=0.728..0.825 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_8.id_contrato = tot_recebido_sem_af_nfe_4.contrato)
438. 0.025 0.625 ↑ 1.3 103 1

Hash Left Join (cost=93.80..99.83 rows=138 width=64) (actual time=0.568..0.625 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_8.id_contrato = tot_recebido_sem_af_nf_4.contrato)
439. 0.035 0.569 ↑ 1.3 103 1

Hash Left Join (cost=64.37..69.87 rows=138 width=56) (actual time=0.526..0.569 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_8.id_contrato = tot_faturado_af_reaj_4.contrato)
440. 0.029 0.361 ↑ 1.3 103 1

Hash Left Join (cost=31.70..36.67 rows=138 width=52) (actual time=0.332..0.361 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_8.id_contrato = tot_recebido_af_4.contrato)
441. 0.015 0.015 ↑ 1.3 103 1

Seq Scan on tb_cntrt tb_cntrt_8 (cost=0.00..4.38 rows=138 width=20) (actual time=0.004..0.015 rows=103 loops=1)

442. 0.005 0.317 ↑ 1.0 7 1

Hash (cost=31.61..31.61 rows=7 width=40) (actual time=0.316..0.317 rows=7 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
443. 0.002 0.312 ↑ 1.0 7 1

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

444. 0.028 0.310 ↑ 1.0 7 1

GroupAggregate (cost=31.30..31.54 rows=7 width=52) (actual time=0.294..0.310 rows=7 loops=1)

  • Group Key: cntrt_34.id_contrato
445. 0.019 0.282 ↓ 3.1 22 1

Sort (cost=31.30..31.31 rows=7 width=40) (actual time=0.281..0.282 rows=22 loops=1)

  • Sort Key: cntrt_34.id_contrato
  • Sort Method: quicksort Memory: 26kB
446. 0.012 0.263 ↓ 3.1 22 1

Nested Loop (cost=17.78..31.20 rows=7 width=40) (actual time=0.128..0.263 rows=22 loops=1)

  • Join Filter: (ftrmnt_25.id_autorizacao_faturamento = tmtrzc_8.id_autorizacao_faturamento)
447. 0.009 0.213 ↓ 6.3 19 1

Nested Loop (cost=17.51..29.45 rows=3 width=36) (actual time=0.116..0.213 rows=19 loops=1)

448. 0.036 0.166 ↓ 6.3 19 1

Hash Join (cost=17.36..28.79 rows=3 width=24) (actual time=0.097..0.166 rows=19 loops=1)

  • Hash Cond: (trzc_15.id_autorizacao_faturamento = ftrmnt_25.id_autorizacao_faturamento)
449. 0.049 0.049 ↑ 1.1 309 1

Seq Scan on tb_trzc_ftrmnt trzc_15 (cost=0.00..10.09 rows=350 width=16) (actual time=0.004..0.049 rows=309 loops=1)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
  • Rows Removed by Filter: 20
450. 0.011 0.081 ↓ 6.3 19 1

Hash (cost=17.32..17.32 rows=3 width=8) (actual time=0.081..0.081 rows=19 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
451. 0.070 0.070 ↓ 6.3 19 1

Seq Scan on tb_ftrmnt ftrmnt_25 (cost=0.00..17.32 rows=3 width=8) (actual time=0.022..0.070 rows=19 loops=1)

  • Filter: (in_situacao_faturamento = 22)
  • Rows Removed by Filter: 427
452. 0.038 0.038 ↑ 1.0 1 19

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

  • Index Cond: (id_contrato = trzc_15.id_contrato)
453. 0.038 0.038 ↑ 3.0 1 19

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

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
455. 0.000 0.173 ↓ 0.0 0 1

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

456. 0.001 0.173 ↓ 0.0 0 1

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

  • Group Key: cntrt_35.id_contrato
457. 0.012 0.172 ↓ 0.0 0 1

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

  • Sort Key: cntrt_35.id_contrato
  • Sort Method: quicksort Memory: 25kB
458. 0.016 0.160 ↓ 0.0 0 1

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

  • Join Filter: (trzc_16.id_autorizacao_faturamento = ftrmnt_26.id_autorizacao_faturamento)
  • Rows Removed by Join Filter: 38
459. 0.068 0.068 ↓ 6.3 19 1

Seq Scan on tb_ftrmnt ftrmnt_26 (cost=0.00..17.32 rows=3 width=8) (actual time=0.022..0.068 rows=19 loops=1)

  • Filter: (in_situacao_faturamento = 22)
  • Rows Removed by Filter: 427
460. 0.002 0.076 ↑ 1.0 2 19

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

461. 0.021 0.074 ↑ 1.0 2 1

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual time=0.061..0.074 rows=2 loops=1)

  • Hash Cond: (cntrt_35.id_contrato = trzc_16.id_contrato)
462. 0.011 0.011 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_35 (cost=0.00..4.38 rows=138 width=20) (actual time=0.003..0.011 rows=103 loops=1)

463. 0.003 0.042 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
464. 0.039 0.039 ↑ 1.0 2 1

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

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
466. 0.000 0.031 ↓ 0.0 0 1

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

467. 0.001 0.031 ↓ 0.0 0 1

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

  • Group Key: cntrt_36.id_contrato
468. 0.005 0.030 ↓ 0.0 0 1

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

  • Sort Key: cntrt_36.id_contrato
  • Sort Method: quicksort Memory: 25kB
469. 0.017 0.025 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_36.id_contrato = ftrmnt_27.nu_processo_compra)
470. 0.003 0.003 ↑ 138.0 1 1

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

471. 0.000 0.005 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
472. 0.000 0.005 ↓ 0.0 0 1

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

473. 0.005 0.005 ↓ 0.0 0 1

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 time=0.005..0.005 rows=0 loops=1)

474. 0.000 0.000 ↓ 0.0 0

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

  • 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.147 ↓ 0.0 0 1

Hash (cost=63.19..63.19 rows=2 width=16) (actual time=0.147..0.147 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
476. 0.001 0.147 ↓ 0.0 0 1

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

477. 0.000 0.146 ↓ 0.0 0 1

GroupAggregate (cost=63.13..63.17 rows=2 width=194) (actual time=0.146..0.146 rows=0 loops=1)

  • Group Key: a_5.contrato, a_5.numero_contrato
478. 0.009 0.146 ↓ 0.0 0 1

Sort (cost=63.13..63.13 rows=2 width=194) (actual time=0.146..0.146 rows=0 loops=1)

  • Sort Key: a_5.contrato, a_5.numero_contrato
  • Sort Method: quicksort Memory: 25kB
479. 0.000 0.137 ↓ 0.0 0 1

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

480. 0.000 0.137 ↓ 0.0 0 1

Unique (cost=63.07..63.10 rows=2 width=202) (actual time=0.137..0.137 rows=0 loops=1)

481. 0.009 0.137 ↓ 0.0 0 1

Sort (cost=63.07..63.08 rows=2 width=202) (actual time=0.137..0.137 rows=0 loops=1)

  • Sort Key: "*SELECT* 1_5".id_faturamento, "*SELECT* 1_5".contrato, "*SELECT* 1_5".numero_contrato, (("*SELECT* 1_5".total_recebido_nf)::double precision)
  • Sort Method: quicksort Memory: 25kB
482. 0.000 0.128 ↓ 0.0 0 1

Append (cost=33.59..63.06 rows=2 width=202) (actual time=0.128..0.128 rows=0 loops=1)

483. 0.000 0.100 ↓ 0.0 0 1

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

484. 0.001 0.100 ↓ 0.0 0 1

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

  • Group Key: ftrmnt_28.id_faturamento, cntrt_37.id_contrato
485. 0.007 0.099 ↓ 0.0 0 1

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

  • Sort Key: ftrmnt_28.id_faturamento, cntrt_37.id_contrato
  • Sort Method: quicksort Memory: 25kB
486. 0.000 0.092 ↓ 0.0 0 1

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

487. 0.001 0.092 ↓ 0.0 0 1

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

488. 0.008 0.091 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_37.id_contrato = ftrmnt_28.nu_processo_compra)
489. 0.005 0.005 ↑ 138.0 1 1

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

490. 0.001 0.078 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
491. 0.077 0.077 ↓ 0.0 0 1

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

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

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

  • Index Cond: (id_faturamento = ftrmnt_28.id_faturamento)
493. 0.000 0.000 ↓ 0.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) (never executed)

  • Index Cond: (id_faturamento = dcmntfscl_5.id_faturamento)
494. 0.001 0.028 ↓ 0.0 0 1

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

  • Group Key: ftrmnt_29.id_faturamento, cntrt_38.id_contrato
495. 0.006 0.027 ↓ 0.0 0 1

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

  • Sort Key: ftrmnt_29.id_faturamento, cntrt_38.id_contrato
  • Sort Method: quicksort Memory: 25kB
496. 0.009 0.021 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_38.id_contrato = ftrmnt_29.nu_processo_compra)
497. 0.003 0.003 ↑ 138.0 1 1

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

498. 0.001 0.009 ↓ 0.0 0 1

Hash (cost=24.46..24.46 rows=1 width=24) (actual time=0.008..0.009 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
499. 0.000 0.008 ↓ 0.0 0 1

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

500. 0.008 0.008 ↓ 0.0 0 1

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 time=0.008..0.008 rows=0 loops=1)

501. 0.000 0.000 ↓ 0.0 0

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

  • 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.021 2.889 ↑ 1.3 103 1

Materialize (cost=182.47..184.54 rows=138 width=16) (actual time=2.867..2.889 rows=103 loops=1)

503. 0.051 2.868 ↑ 1.3 103 1

Sort (cost=182.47..182.81 rows=138 width=28) (actual time=2.860..2.868 rows=103 loops=1)

  • Sort Key: tb_cntrt_9.id_contrato, tb_cntrt_9.nu_contrato
  • Sort Method: quicksort Memory: 33kB
504. 0.089 2.817 ↑ 1.3 103 1

Hash Left Join (cost=168.26..177.56 rows=138 width=28) (actual time=2.631..2.817 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_9.id_contrato = tot_recebido_sem_af_nfe_5.contrato)
505. 0.036 2.081 ↑ 1.3 103 1

Hash Left Join (cost=105.05..111.74 rows=138 width=67) (actual time=1.966..2.081 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_9.id_contrato = tot_recebido_sem_af_nf_5.contrato)
506. 0.036 2.016 ↑ 1.3 103 1

Hash Left Join (cost=75.62..81.78 rows=138 width=59) (actual time=1.917..2.016 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_9.id_contrato = tot_recebido_af_5.contrato)
507. 0.029 0.469 ↑ 1.3 103 1

Hash Left Join (cost=41.86..47.39 rows=138 width=27) (actual time=0.391..0.469 rows=103 loops=1)

  • Hash Cond: (tb_cntrt_9.id_contrato = tot_faturado_af_reaj_5.contrato)
508. 0.037 0.170 ↑ 1.3 103 1

Hash Right Join (cost=9.13..14.13 rows=138 width=23) (actual time=0.108..0.170 rows=103 loops=1)

  • Hash Cond: (cntrt_39.id_contrato = tb_cntrt_9.id_contrato)
509. 0.045 0.095 ↓ 1.1 101 1

Hash Join (cost=3.02..7.78 rows=90 width=11) (actual time=0.059..0.095 rows=101 loops=1)

  • Hash Cond: (cntrt_39.id_contrato = pre_3.id_contrato)
510. 0.014 0.014 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_39 (cost=0.00..4.38 rows=138 width=8) (actual time=0.002..0.014 rows=103 loops=1)

511. 0.022 0.036 ↓ 1.1 101 1

Hash (cost=1.90..1.90 rows=90 width=11) (actual time=0.036..0.036 rows=101 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
512. 0.014 0.014 ↓ 1.1 101 1

Seq Scan on tb_vl_tlzd_pr_vtr pre_3 (cost=0.00..1.90 rows=90 width=11) (actual time=0.004..0.014 rows=101 loops=1)

513. 0.021 0.038 ↑ 1.3 103 1

Hash (cost=4.38..4.38 rows=138 width=20) (actual time=0.038..0.038 rows=103 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
514. 0.017 0.017 ↑ 1.3 103 1

Seq Scan on tb_cntrt tb_cntrt_9 (cost=0.00..4.38 rows=138 width=20) (actual time=0.004..0.017 rows=103 loops=1)

515. 0.000 0.270 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
516. 0.001 0.270 ↓ 0.0 0 1

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

517. 0.000 0.269 ↓ 0.0 0 1

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

  • Group Key: cntrt_40.id_contrato
518. 0.008 0.269 ↓ 0.0 0 1

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

  • Sort Key: cntrt_40.id_contrato
  • Sort Method: quicksort Memory: 25kB
519. 0.173 0.261 ↓ 0.0 0 1

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

  • Join Filter: (trzc_17.id_autorizacao_faturamento = ftrmnt_30.id_autorizacao_faturamento)
  • Rows Removed by Join Filter: 492
520. 0.088 0.088 ↓ 49.2 246 1

Seq Scan on tb_ftrmnt ftrmnt_30 (cost=0.00..17.32 rows=5 width=8) (actual time=0.005..0.088 rows=246 loops=1)

  • Filter: (in_situacao_faturamento = ANY ('{12,13}'::bigint[]))
  • Rows Removed by Filter: 200
521. 0.000 0.000 ↑ 1.0 2 246

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

522. 0.018 0.069 ↑ 1.0 2 1

Hash Join (cost=10.11..15.20 rows=2 width=32) (actual time=0.057..0.069 rows=2 loops=1)

  • Hash Cond: (cntrt_40.id_contrato = trzc_17.id_contrato)
523. 0.010 0.010 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_40 (cost=0.00..4.38 rows=138 width=20) (actual time=0.002..0.010 rows=103 loops=1)

524. 0.003 0.041 ↑ 1.0 2 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
525. 0.038 0.038 ↑ 1.0 2 1

Seq Scan on tb_trzc_ftrmnt trzc_17 (cost=0.00..10.09 rows=2 width=20) (actual time=0.015..0.038 rows=2 loops=1)

  • Filter: ((vl_autorizado_reajuste IS NOT NULL) AND (in_situacao = ANY ('{3,4,5}'::integer[])))
  • Rows Removed by Filter: 327
526. 0.012 1.511 ↓ 4.4 53 1

Hash (cost=33.60..33.60 rows=12 width=40) (actual time=1.511..1.511 rows=53 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
527. 0.007 1.499 ↓ 4.4 53 1

Subquery Scan on tot_recebido_af_5 (cost=33.06..33.60 rows=12 width=40) (actual time=1.247..1.499 rows=53 loops=1)

528. 0.241 1.492 ↓ 4.4 53 1

GroupAggregate (cost=33.06..33.48 rows=12 width=52) (actual time=1.246..1.492 rows=53 loops=1)

  • Group Key: cntrt_41.id_contrato
529. 0.200 1.251 ↓ 42.9 515 1

Sort (cost=33.06..33.09 rows=12 width=40) (actual time=1.229..1.251 rows=515 loops=1)

  • Sort Key: cntrt_41.id_contrato
  • Sort Method: quicksort Memory: 65kB
530. 0.134 1.051 ↓ 42.9 515 1

Nested Loop (cost=17.81..32.85 rows=12 width=40) (actual time=0.159..1.051 rows=515 loops=1)

  • Join Filter: (ftrmnt_31.id_autorizacao_faturamento = tmtrzc_9.id_autorizacao_faturamento)
531. 0.104 0.553 ↓ 36.4 182 1

Nested Loop (cost=17.53..29.94 rows=5 width=36) (actual time=0.151..0.553 rows=182 loops=1)

532. 0.076 0.267 ↓ 36.4 182 1

Hash Join (cost=17.39..28.84 rows=5 width=24) (actual time=0.139..0.267 rows=182 loops=1)

  • Hash Cond: (trzc_18.id_autorizacao_faturamento = ftrmnt_31.id_autorizacao_faturamento)
533. 0.066 0.066 ↑ 1.1 309 1

Seq Scan on tb_trzc_ftrmnt trzc_18 (cost=0.00..10.09 rows=350 width=16) (actual time=0.004..0.066 rows=309 loops=1)

  • Filter: (in_situacao = ANY ('{3,4,5}'::integer[]))
  • Rows Removed by Filter: 20
534. 0.029 0.125 ↓ 36.4 182 1

Hash (cost=17.32..17.32 rows=5 width=8) (actual time=0.125..0.125 rows=182 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
535. 0.096 0.096 ↓ 49.2 246 1

Seq Scan on tb_ftrmnt ftrmnt_31 (cost=0.00..17.32 rows=5 width=8) (actual time=0.004..0.096 rows=246 loops=1)

  • Filter: (in_situacao_faturamento = ANY ('{12,13}'::bigint[]))
  • Rows Removed by Filter: 200
536. 0.182 0.182 ↑ 1.0 1 182

Index Scan using tb_cntrt_id_contrato_idx on tb_cntrt cntrt_41 (cost=0.14..0.22 rows=1 width=20) (actual time=0.001..0.001 rows=1 loops=182)

  • Index Cond: (id_contrato = trzc_18.id_contrato)
537. 0.364 0.364 ↑ 1.0 3 182

Index Scan using tb_tm_trzc_pkey on tb_tm_trzc tmtrzc_9 (cost=0.28..0.54 rows=3 width=28) (actual time=0.001..0.002 rows=3 loops=182)

  • Index Cond: (id_autorizacao_faturamento = trzc_18.id_autorizacao_faturamento)
538. 0.000 0.029 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
539. 0.000 0.029 ↓ 0.0 0 1

Subquery Scan on tot_recebido_sem_af_nf_5 (cost=29.39..29.42 rows=1 width=16) (actual time=0.029..0.029 rows=0 loops=1)

540. 0.001 0.029 ↓ 0.0 0 1

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

  • Group Key: cntrt_42.id_contrato
541. 0.010 0.028 ↓ 0.0 0 1

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

  • Sort Key: cntrt_42.id_contrato
  • Sort Method: quicksort Memory: 25kB
542. 0.008 0.018 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_42.id_contrato = ftrmnt_32.nu_processo_compra)
543. 0.004 0.004 ↑ 138.0 1 1

Seq Scan on tb_cntrt cntrt_42 (cost=0.00..4.38 rows=138 width=20) (actual time=0.004..0.004 rows=1 loops=1)

544. 0.001 0.006 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
545. 0.000 0.005 ↓ 0.0 0 1

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

546. 0.005 0.005 ↓ 0.0 0 1

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 time=0.005..0.005 rows=0 loops=1)

547. 0.000 0.000 ↓ 0.0 0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_32 (cost=0.27..8.30 rows=1 width=16) (never executed)

  • 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.003 0.647 ↑ 2.0 1 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
549. 0.001 0.644 ↑ 2.0 1 1

Subquery Scan on tot_recebido_sem_af_nfe_5 (cost=63.13..63.19 rows=2 width=16) (actual time=0.644..0.644 rows=1 loops=1)

550. 0.013 0.643 ↑ 2.0 1 1

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

  • Group Key: a_6.contrato, a_6.numero_contrato
551. 0.022 0.630 ↓ 31.5 63 1

Sort (cost=63.13..63.13 rows=2 width=194) (actual time=0.628..0.630 rows=63 loops=1)

  • Sort Key: a_6.contrato, a_6.numero_contrato
  • Sort Method: quicksort Memory: 29kB
552. 0.009 0.608 ↓ 31.5 63 1

Subquery Scan on a_6 (cost=63.07..63.12 rows=2 width=194) (actual time=0.584..0.608 rows=63 loops=1)

553. 0.013 0.599 ↓ 31.5 63 1

Unique (cost=63.07..63.10 rows=2 width=202) (actual time=0.583..0.599 rows=63 loops=1)

554. 0.027 0.586 ↓ 31.5 63 1

Sort (cost=63.07..63.08 rows=2 width=202) (actual time=0.583..0.586 rows=63 loops=1)

  • Sort Key: "*SELECT* 1_6".id_faturamento, "*SELECT* 1_6".contrato, "*SELECT* 1_6".numero_contrato, (("*SELECT* 1_6".total_recebido_nf)::double precision)
  • Sort Method: quicksort Memory: 29kB
555. 0.005 0.559 ↓ 31.5 63 1

Append (cost=33.59..63.06 rows=2 width=202) (actual time=0.392..0.559 rows=63 loops=1)

556. 0.033 0.522 ↓ 63.0 63 1

Subquery Scan on *SELECT* 1_6 (cost=33.59..33.64 rows=1 width=36) (actual time=0.392..0.522 rows=63 loops=1)

557. 0.112 0.489 ↓ 63.0 63 1

GroupAggregate (cost=33.59..33.63 rows=1 width=60) (actual time=0.388..0.489 rows=63 loops=1)

  • Group Key: ftrmnt_33.id_faturamento, cntrt_43.id_contrato
558. 0.037 0.377 ↓ 63.0 63 1

Sort (cost=33.59..33.59 rows=1 width=49) (actual time=0.372..0.377 rows=63 loops=1)

  • Sort Key: ftrmnt_33.id_faturamento, cntrt_43.id_contrato
  • Sort Method: quicksort Memory: 29kB
559. 0.015 0.340 ↓ 63.0 63 1

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

560. 0.045 0.262 ↓ 63.0 63 1

Nested Loop (cost=20.14..33.10 rows=1 width=43) (actual time=0.148..0.262 rows=63 loops=1)

561. 0.030 0.154 ↓ 63.0 63 1

Hash Join (cost=19.87..24.77 rows=1 width=28) (actual time=0.135..0.154 rows=63 loops=1)

  • Hash Cond: (cntrt_43.id_contrato = ftrmnt_33.nu_processo_compra)
562. 0.012 0.012 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt_43 (cost=0.00..4.38 rows=138 width=20) (actual time=0.003..0.012 rows=103 loops=1)

563. 0.013 0.112 ↓ 63.0 63 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
564. 0.099 0.099 ↓ 64.0 64 1

Seq Scan on tb_ftrmnt ftrmnt_33 (cost=0.00..19.86 rows=1 width=16) (actual time=0.006..0.099 rows=64 loops=1)

  • Filter: ((id_autorizacao_faturamento IS NULL) AND (in_situacao_faturamento = ANY ('{12,13}'::bigint[])) AND (cd_tipo_faturamento = ANY ('{1,2,3,4}'::bigint[])))
  • Rows Removed by Filter: 382
565. 0.063 0.063 ↑ 1.0 1 63

Index Scan using tb_dcmnt_fscl_pkey on tb_dcmnt_fscl dcmntfscl_6 (cost=0.27..8.29 rows=1 width=15) (actual time=0.001..0.001 rows=1 loops=63)

  • Index Cond: (id_faturamento = ftrmnt_33.id_faturamento)
566. 0.063 0.063 ↓ 0.0 0 63

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 time=0.001..0.001 rows=0 loops=63)

  • Index Cond: (id_faturamento = dcmntfscl_6.id_faturamento)
567. 0.001 0.032 ↓ 0.0 0 1

GroupAggregate (cost=29.39..29.41 rows=1 width=36) (actual time=0.031..0.032 rows=0 loops=1)

  • Group Key: ftrmnt_34.id_faturamento, cntrt_44.id_contrato
568. 0.008 0.031 ↓ 0.0 0 1

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

  • Sort Key: ftrmnt_34.id_faturamento, cntrt_44.id_contrato
  • Sort Method: quicksort Memory: 25kB
569. 0.014 0.023 ↓ 0.0 0 1

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

  • Hash Cond: (cntrt_44.id_contrato = ftrmnt_34.nu_processo_compra)
570. 0.004 0.004 ↑ 138.0 1 1

Seq Scan on tb_cntrt cntrt_44 (cost=0.00..4.38 rows=138 width=20) (actual time=0.004..0.004 rows=1 loops=1)

571. 0.000 0.005 ↓ 0.0 0 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
572. 0.000 0.005 ↓ 0.0 0 1

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

573. 0.005 0.005 ↓ 0.0 0 1

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 time=0.005..0.005 rows=0 loops=1)

574. 0.000 0.000 ↓ 0.0 0

Index Scan using tb_ftrmnt_pkey on tb_ftrmnt ftrmnt_34 (cost=0.27..8.30 rows=1 width=16) (never executed)

  • 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.015 0.088 ↓ 1.1 101 1

Hash (cost=7.78..7.78 rows=90 width=8) (actual time=0.088..0.088 rows=101 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
576. 0.029 0.073 ↓ 1.1 101 1

Hash Join (cost=3.02..7.78 rows=90 width=8) (actual time=0.044..0.073 rows=101 loops=1)

  • Hash Cond: (cntrt.id_contrato = pre.id_contrato)
577. 0.015 0.015 ↑ 1.3 103 1

Seq Scan on tb_cntrt cntrt (cost=0.00..4.38 rows=138 width=8) (actual time=0.005..0.015 rows=103 loops=1)

578. 0.017 0.029 ↓ 1.1 101 1

Hash (cost=1.90..1.90 rows=90 width=8) (actual time=0.029..0.029 rows=101 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
579. 0.012 0.012 ↓ 1.1 101 1

Seq Scan on tb_vl_tlzd_pr_vtr pre (cost=0.00..1.90 rows=90 width=8) (actual time=0.003..0.012 rows=101 loops=1)

Planning time : 38.456 ms
Execution time : 23.555 ms