explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PolY

Settings
# exclusive inclusive rows x rows loops node
1. 0.023 56.730 ↑ 4.0 1 1

GroupAggregate (cost=2,892.72..2,892.92 rows=4 width=215) (actual time=56.730..56.730 rows=1 loops=1)

2. 0.017 56.707 ↑ 4.0 1 1

Sort (cost=2,892.72..2,892.73 rows=4 width=215) (actual time=56.707..56.707 rows=1 loops=1)

  • Sort Key: temp1.ds_fonte_recurso, temp1.id_entidade_conveniada, temp1.id_fonte_recurso, temp1.id_plt_entidade
  • Sort Method: quicksort Memory: 25kB
3. 0.004 56.690 ↑ 4.0 1 1

Subquery Scan on temp1 (cost=2,892.60..2,892.68 rows=4 width=215) (actual time=56.689..56.690 rows=1 loops=1)

4. 0.020 56.686 ↑ 4.0 1 1

HashAggregate (cost=2,892.60..2,892.64 rows=4 width=215) (actual time=56.686..56.686 rows=1 loops=1)

5. 1.934 56.666 ↑ 4.0 1 1

Subquery Scan on t1 (cost=2,892.36..2,892.51 rows=4 width=215) (actual time=56.664..56.666 rows=1 loops=1)

  • Filter: ((hashed SubPlan 1) OR (t1.id_edicao_aditivo > 0))
6. 0.015 46.606 ↑ 6.0 1 1

HashAggregate (cost=2,568.30..2,568.36 rows=6 width=132) (actual time=46.605..46.606 rows=1 loops=1)

7. 0.003 46.591 ↑ 6.0 1 1

Append (cost=2,052.48..2,567.97 rows=6 width=132) (actual time=15.845..46.591 rows=1 loops=1)

8. 0.006 15.844 ↑ 5.0 1 1

Result (cost=2,052.48..2,052.53 rows=5 width=132) (actual time=15.843..15.844 rows=1 loops=1)

9. 0.014 15.838 ↑ 5.0 1 1

HashAggregate (cost=2,052.48..2,052.53 rows=5 width=132) (actual time=15.837..15.838 rows=1 loops=1)

10. 0.001 15.824 ↑ 5.0 1 1

Append (cost=1,556.74..2,052.21 rows=5 width=132) (actual time=2.590..15.824 rows=1 loops=1)

11. 0.006 2.590 ↑ 4.0 1 1

Result (cost=1,556.74..1,556.78 rows=4 width=152) (actual time=2.589..2.590 rows=1 loops=1)

12. 0.010 2.584 ↑ 4.0 1 1

HashAggregate (cost=1,556.74..1,556.78 rows=4 width=152) (actual time=2.583..2.584 rows=1 loops=1)

13. 0.003 2.574 ↑ 4.0 1 1

Append (cost=684.97..1,556.52 rows=4 width=152) (actual time=1.126..2.574 rows=1 loops=1)

14. 0.003 1.125 ↑ 3.0 1 1

Result (cost=684.97..685.00 rows=3 width=151) (actual time=1.125..1.125 rows=1 loops=1)

15. 0.016 1.122 ↑ 3.0 1 1

HashAggregate (cost=684.97..685.00 rows=3 width=151) (actual time=1.122..1.122 rows=1 loops=1)

16. 0.001 1.106 ↑ 3.0 1 1

Append (cost=2.66..684.80 rows=3 width=151) (actual time=0.780..1.106 rows=1 loops=1)

17. 0.006 1.091 ↑ 1.0 1 1

Subquery Scan on *SELECT* 1 (cost=2.66..92.03 rows=1 width=155) (actual time=0.779..1.091 rows=1 loops=1)

18. 0.006 1.085 ↑ 1.0 1 1

Nested Loop (cost=2.66..92.02 rows=1 width=155) (actual time=0.774..1.085 rows=1 loops=1)

19. 0.003 1.074 ↑ 1.0 1 1

Nested Loop (cost=2.53..91.85 rows=1 width=143) (actual time=0.765..1.074 rows=1 loops=1)

20. 0.004 1.059 ↑ 1.0 1 1

Nested Loop (cost=2.40..91.69 rows=1 width=139) (actual time=0.751..1.059 rows=1 loops=1)

21. 0.002 1.042 ↑ 1.0 1 1

Nested Loop (cost=2.10..83.73 rows=1 width=125) (actual time=0.735..1.042 rows=1 loops=1)

22. 0.013 1.024 ↑ 1.0 1 1

Nested Loop (cost=1.82..75.42 rows=1 width=129) (actual time=0.718..1.024 rows=1 loops=1)

23. 0.037 0.436 ↓ 3.3 23 1

Nested Loop (cost=1.41..62.59 rows=7 width=117) (actual time=0.071..0.436 rows=23 loops=1)

24. 0.035 0.307 ↓ 3.3 23 1

Nested Loop (cost=1.12..59.89 rows=7 width=94) (actual time=0.061..0.307 rows=23 loops=1)

25. 0.013 0.180 ↓ 3.8 23 1

Nested Loop (cost=0.84..56.97 rows=6 width=24) (actual time=0.053..0.180 rows=23 loops=1)

26. 0.011 0.089 ↑ 1.0 6 1

Nested Loop (cost=0.56..54.30 rows=6 width=16) (actual time=0.035..0.089 rows=6 loops=1)

27. 0.024 0.024 ↑ 1.0 6 1

Index Scan using idx_tb_plt_convenio_id_convenio on tb_plt_convenio l (cost=0.28..8.44 rows=6 width=8) (actual time=0.020..0.024 rows=6 loops=1)

  • Index Cond: (id_convenio = 2394)
28. 0.054 0.054 ↑ 1.0 1 6

Index Scan using pk_tb_plano_trabalho on tb_plt_entidade b (cost=0.28..7.63 rows=1 width=8) (actual time=0.008..0.009 rows=1 loops=6)

  • Index Cond: (id_plt_entidade = l.id_plt_entidade)
29. 0.078 0.078 ↓ 4.0 4 6

Index Scan using idx_tb_plt_edicao_id_plt_entidade on tb_plt_edicao a (cost=0.28..0.43 rows=1 width=16) (actual time=0.007..0.013 rows=4 loops=6)

  • Index Cond: (id_plt_entidade = b.id_plt_entidade)
  • Filter: (id_status_plt = ANY ('{5,8}'::integer[]))
  • Rows Removed by Filter: 1
30. 0.092 0.092 ↑ 1.0 1 23

Index Scan using idx_tb_item_plt_id_plt_edicao on tb_item_plt c (cost=0.28..0.48 rows=1 width=74) (actual time=0.004..0.004 rows=1 loops=23)

  • Index Cond: (id_plt_edicao = a.id_plt_edicao)
31. 0.092 0.092 ↑ 1.0 1 23

Index Scan using idx_tb_subitem_plt_id_item_plt on tb_subitem_plt d (cost=0.28..0.38 rows=1 width=27) (actual time=0.004..0.004 rows=1 loops=23)

  • Index Cond: (id_item_plt = c.id_item_plt)
32. 0.575 0.575 ↓ 0.0 0 23

Index Scan using idx_tb_desp_subitem_id_subitem_plt on tb_desp_subitem e (cost=0.42..1.82 rows=1 width=16) (actual time=0.024..0.025 rows=0 loops=23)

  • Index Cond: (id_subitem_plt = d.id_subitem_plt)
  • Filter: ((id_despesa = 11) AND (id_item_despesa = 241))
  • Rows Removed by Filter: 32
33. 0.016 0.016 ↑ 1.0 1 1

Index Only Scan using pk_tb_convenio on tb_convenio g (cost=0.28..8.30 rows=1 width=4) (actual time=0.015..0.016 rows=1 loops=1)

  • Index Cond: (id_convenio = 2394)
  • Heap Fetches: 1
34. 0.013 0.013 ↑ 1.0 1 1

Index Scan using idx_tb_fonte_recurso_plt on tb_fonte_recurso_plt h (cost=0.29..7.95 rows=1 width=18) (actual time=0.013..0.013 rows=1 loops=1)

  • Index Cond: (id_desp_sub_item = e.id_desp_subitem)
35. 0.012 0.012 ↑ 1.0 1 1

Index Scan using pk_tb_fonte_recurso on tb_fonte_recurso i (cost=0.13..0.16 rows=1 width=4) (actual time=0.011..0.012 rows=1 loops=1)

  • Index Cond: (id_fonte_recurso = h.id_fonte_recurso)
  • Filter: (flg_valor <> 'N'::bpchar)
36. 0.005 0.005 ↑ 1.0 1 1

Index Scan using pk_tb_fonte_recurso_ent on tb_fonte_recurso_sub j (cost=0.13..0.15 rows=1 width=16) (actual time=0.004..0.005 rows=1 loops=1)

  • Index Cond: (id_fonte_recurso_sub = h.id_fonte_recurso)
37. 0.001 0.014 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2 (cost=445.16..592.78 rows=2 width=149) (actual time=0.014..0.014 rows=0 loops=1)

38. 0.001 0.013 ↓ 0.0 0 1

Hash Left Join (cost=445.16..592.76 rows=2 width=149) (actual time=0.013..0.013 rows=0 loops=1)

  • Hash Cond: (plt.id_fonte_recurso = j_1.id_fonte_recurso_sub)
39. 0.000 0.012 ↓ 0.0 0 1

Nested Loop Left Join (cost=444.02..591.59 rows=2 width=133) (actual time=0.012..0.012 rows=0 loops=1)

40. 0.000 0.012 ↓ 0.0 0 1

Nested Loop Left Join (cost=443.74..590.89 rows=2 width=129) (actual time=0.012..0.012 rows=0 loops=1)

41. 0.001 0.012 ↓ 0.0 0 1

Nested Loop Left Join (cost=443.46..574.27 rows=2 width=117) (actual time=0.012..0.012 rows=0 loops=1)

42. 0.000 0.011 ↓ 0.0 0 1

Nested Loop Left Join (cost=443.18..557.65 rows=2 width=51) (actual time=0.011..0.011 rows=0 loops=1)

43. 0.000 0.011 ↓ 0.0 0 1

Nested Loop Left Join (cost=442.90..541.03 rows=2 width=32) (actual time=0.011..0.011 rows=0 loops=1)

44. 0.001 0.011 ↓ 0.0 0 1

Hash Left Join (cost=442.48..524.14 rows=2 width=30) (actual time=0.011..0.011 rows=0 loops=1)

  • Hash Cond: ((plt.id_desp_subitem = desp_plano.id_desp_subitem) AND (plt.id_fonte_recurso = desp_plano.id_fonte_recurso))
45. 0.000 0.010 ↓ 0.0 0 1

Nested Loop (cost=0.86..82.50 rows=2 width=30) (actual time=0.010..0.010 rows=0 loops=1)

46. 0.010 0.010 ↓ 0.0 0 1

Index Scan using idx_tb_plt_pdc_id_item_pdc on tb_plt_pdc plt (cost=0.43..8.47 rows=2 width=30) (actual time=0.010..0.010 rows=0 loops=1)

  • Index Cond: (id_item_pdc = 0)
47. 0.000 0.000 ↓ 0.0 0

Index Only Scan using ix_tb_status_item_pdc_01 on tb_status_item_pdc z (cost=0.43..36.84 rows=17 width=4) (never executed)

  • Index Cond: (id_plt_pdc = plt.id_plt_pdc)
  • Heap Fetches: 0
48. 0.000 0.000 ↓ 0.0 0

Hash (cost=441.59..441.59 rows=2 width=8) (never executed)

49. 0.000 0.000 ↓ 0.0 0

Subquery Scan on desp_plano (cost=441.43..441.59 rows=2 width=8) (never executed)

50. 0.000 0.000 ↓ 0.0 0

Group (cost=441.43..441.57 rows=2 width=100) (never executed)

51. 0.000 0.000 ↓ 0.0 0

Unique (cost=441.43..441.49 rows=2 width=117) (never executed)

52. 0.000 0.000 ↓ 0.0 0

Sort (cost=441.43..441.44 rows=2 width=117) (never executed)

  • Sort Key: l_1.id_convenio, a_2.id_plt_entidade, a_2.id_plt_edicao, c_2.id_item_plt, c_2.ds_item_plt, d_2.id_subitem_plt, d_2.ds_subitem_plt, e_2.id_desp_subitem, e_2.id_despesa, e_2.id_item_despesa, h_1.id_fonte_recurso
53. 0.000 0.000 ↓ 0.0 0

Append (cost=2.40..441.42 rows=2 width=117) (never executed)

54. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=2.40..91.69 rows=1 width=117) (never executed)

55. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.10..83.73 rows=1 width=113) (never executed)

56. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.82..75.43 rows=1 width=113) (never executed)

57. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.41..62.59 rows=7 width=101) (never executed)

58. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.12..59.89 rows=7 width=82) (never executed)

59. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.84..56.97 rows=6 width=12) (never executed)

60. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.56..54.30 rows=6 width=12) (never executed)

61. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_plt_convenio_id_convenio on tb_plt_convenio l_1 (cost=0.28..8.44 rows=6 width=8) (never executed)

  • Index Cond: (id_convenio = 2394)
62. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pk_tb_plano_trabalho on tb_plt_entidade b_2 (cost=0.28..7.63 rows=1 width=4) (never executed)

  • Index Cond: (id_plt_entidade = l_1.id_plt_entidade)
  • Heap Fetches: 0
63. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_plt_edicao_id_plt_entidade on tb_plt_edicao a_2 (cost=0.28..0.43 rows=1 width=8) (never executed)

  • Index Cond: (id_plt_entidade = b_2.id_plt_entidade)
  • Filter: (id_status_plt = 5)
64. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_item_plt_id_plt_edicao on tb_item_plt c_2 (cost=0.28..0.48 rows=1 width=74) (never executed)

  • Index Cond: (id_plt_edicao = a_2.id_plt_edicao)
65. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_subitem_plt_id_item_plt on tb_subitem_plt d_2 (cost=0.28..0.38 rows=1 width=23) (never executed)

  • Index Cond: (id_item_plt = c_2.id_item_plt)
66. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_desp_subitem_id_subitem_plt on tb_desp_subitem e_2 (cost=0.42..1.82 rows=1 width=16) (never executed)

  • Index Cond: (id_subitem_plt = d_2.id_subitem_plt)
  • Filter: ((id_despesa = 11) AND (id_item_despesa = 241))
67. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pk_tb_convenio on tb_convenio g_1 (cost=0.28..8.30 rows=1 width=4) (never executed)

  • Index Cond: (id_convenio = 2394)
  • Heap Fetches: 0
68. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_fonte_recurso_plt on tb_fonte_recurso_plt h_1 (cost=0.29..7.95 rows=1 width=8) (never executed)

  • Index Cond: (id_desp_sub_item = e_2.id_desp_subitem)
69. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=323.57..349.71 rows=1 width=117) (never executed)

70. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=323.16..347.94 rows=1 width=113) (never executed)

71. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=322.87..347.55 rows=1 width=94) (never executed)

72. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=322.59..347.06 rows=1 width=24) (never executed)

73. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=322.31..338.75 rows=1 width=16) (never executed)

  • Join Filter: (tb_pedido_alteracao.id_plt_entidade = tb_plt_convenio.id_plt_entidade)
74. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=322.03..330.23 rows=1 width=16) (never executed)

75. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=321.75..329.80 rows=1 width=8) (never executed)

76. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=321.47..321.48 rows=1 width=12) (never executed)

77. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on tb_item_pedido_nova tb_item_pedido_nova_1 (cost=36.34..321.46 rows=1 width=12) (never executed)

  • Recheck Cond: (id_despesa_nova = 11)
  • Filter: ((id_status_item_ped = 3) AND (id_item_despesa_nova = 241))
78. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on idx_tb_item_pedido_nova_id_despesa_nova (cost=0.00..36.34 rows=1,607 width=0) (never executed)

  • Index Cond: (id_despesa_nova = 11)
79. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_pedido_alteracao on tb_pedido_alteracao (cost=0.28..8.30 rows=1 width=8) (never executed)

  • Index Cond: (id_pedido_alteracao = tb_item_pedido_nova_1.id_pedido_alteracao)
80. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_plt_edicao_id_plt_entidade on tb_plt_edicao (cost=0.28..0.43 rows=1 width=8) (never executed)

  • Index Cond: (id_plt_entidade = tb_pedido_alteracao.id_plt_entidade)
  • Filter: (id_status_plt = 5)
81. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_plt_convenio_id_convenio on tb_plt_convenio (cost=0.28..8.44 rows=6 width=8) (never executed)

  • Index Cond: (id_convenio = 2394)
82. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_item_pedido_nova on tb_item_pedido_nova (cost=0.28..8.31 rows=1 width=16) (never executed)

  • Index Cond: (id_item_pedido_nova = (max(tb_item_pedido_nova_1.id_item_pedido_nova)))
  • Filter: ((id_item_despesa_nova = 241) AND (id_despesa_nova = 11))
83. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_item_plt_id_plt_edicao on tb_item_plt (cost=0.28..0.48 rows=1 width=74) (never executed)

  • Index Cond: (id_plt_edicao = tb_plt_edicao.id_plt_edicao)
84. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_subitem_plt_id_item_plt on tb_subitem_plt (cost=0.28..0.38 rows=1 width=23) (never executed)

  • Index Cond: (id_item_plt = tb_item_plt.id_item_plt)
85. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_desp_subitem_id_subitem_plt on tb_desp_subitem (cost=0.42..1.77 rows=1 width=12) (never executed)

  • Index Cond: (id_subitem_plt = tb_subitem_plt.id_subitem_plt)
  • Filter: (id_item_despesa = 241)
86. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_desp_subitem on tb_desp_subitem e_1 (cost=0.42..8.44 rows=1 width=6) (never executed)

  • Index Cond: (id_desp_subitem = plt.id_desp_subitem)
87. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_subitem_plt on tb_subitem_plt d_1 (cost=0.28..8.30 rows=1 width=23) (never executed)

  • Index Cond: (id_subitem_plt = plt.id_subitem_plt)
88. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_itens_plano_trabalho on tb_item_plt c_1 (cost=0.28..8.30 rows=1 width=70) (never executed)

  • Index Cond: (id_item_plt = plt.id_item_plt)
89. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_plt_edicao on tb_plt_edicao a_1 (cost=0.28..8.30 rows=1 width=16) (never executed)

  • Index Cond: (id_plt_edicao = plt.id_plt_edicao)
90. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_plano_trabalho on tb_plt_entidade b_1 (cost=0.28..0.34 rows=1 width=8) (never executed)

  • Index Cond: (id_plt_entidade = a_1.id_plt_entidade)
91. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.06..1.06 rows=6 width=16) (never executed)

92. 0.000 0.000 ↓ 0.0 0

Seq Scan on tb_fonte_recurso_sub j_1 (cost=0.00..1.06 rows=6 width=16) (never executed)

93. 0.001 1.446 ↓ 0.0 0 1

Subquery Scan on *SELECT* 3 (cost=871.50..871.52 rows=1 width=153) (actual time=1.446..1.446 rows=0 loops=1)

94. 0.001 1.445 ↓ 0.0 0 1

HashAggregate (cost=871.50..871.51 rows=1 width=153) (actual time=1.445..1.445 rows=0 loops=1)

95. 0.000 1.444 ↓ 0.0 0 1

Nested Loop (cost=585.98..871.45 rows=1 width=153) (actual time=1.444..1.444 rows=0 loops=1)

96. 0.001 1.444 ↓ 0.0 0 1

Nested Loop (cost=585.85..871.29 rows=1 width=141) (actual time=1.444..1.444 rows=0 loops=1)

97. 0.001 1.443 ↓ 0.0 0 1

Nested Loop (cost=585.58..862.99 rows=1 width=149) (actual time=1.443..1.443 rows=0 loops=1)

98. 0.000 1.442 ↓ 0.0 0 1

Nested Loop Left Join (cost=585.58..861.84 rows=1 width=149) (actual time=1.442..1.442 rows=0 loops=1)

  • Join Filter: ((desp.id_despesa = item_antigo.id_despesa_ant) AND (desp.id_item_despesa = item_antigo.id_item_despesa_ant))
99. 0.000 1.442 ↓ 0.0 0 1

Nested Loop (cost=585.16..859.84 rows=1 width=151) (actual time=1.442..1.442 rows=0 loops=1)

100. 0.014 1.442 ↓ 0.0 0 1

Hash Join (cost=584.88..851.53 rows=1 width=137) (actual time=1.442..1.442 rows=0 loops=1)

  • Hash Cond: (item_antigo.id_pedido_alteracao = tb_item_pedido_nova_2.id_pedido_alteracao)
101. 0.023 0.023 ↑ 4,773.0 1 1

Seq Scan on tb_item_pedido_antigo item_antigo (cost=0.00..248.73 rows=4,773 width=16) (actual time=0.023..0.023 rows=1 loops=1)

102. 0.000 1.405 ↓ 0.0 0 1

Hash (cost=584.87..584.87 rows=1 width=133) (actual time=1.405..1.405 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 0kB
103. 0.000 1.405 ↓ 0.0 0 1

Nested Loop (cost=494.53..584.87 rows=1 width=133) (actual time=1.405..1.405 rows=0 loops=1)

104. 0.000 1.405 ↓ 0.0 0 1

Nested Loop (cost=494.39..584.69 rows=1 width=137) (actual time=1.405..1.405 rows=0 loops=1)

105. 0.002 1.405 ↓ 0.0 0 1

Nested Loop (cost=494.11..584.31 rows=1 width=114) (actual time=1.405..1.405 rows=0 loops=1)

106. 0.000 1.403 ↓ 0.0 0 1

Nested Loop (cost=493.83..583.89 rows=1 width=48) (actual time=1.403..1.403 rows=0 loops=1)

107. 0.000 1.403 ↓ 0.0 0 1

Nested Loop (cost=493.55..583.46 rows=1 width=36) (actual time=1.403..1.403 rows=0 loops=1)

108. 0.000 1.403 ↓ 0.0 0 1

Nested Loop (cost=493.27..583.06 rows=1 width=36) (actual time=1.403..1.403 rows=0 loops=1)

  • Join Filter: (tb_plt_edicao_1.id_plt_entidade = plt_alt.id_plt_entidade)
109. 0.001 1.403 ↓ 0.0 0 1

Nested Loop (cost=317.75..334.14 rows=1 width=24) (actual time=1.403..1.403 rows=0 loops=1)

110. 0.002 1.402 ↓ 0.0 0 1

HashAggregate (cost=317.47..317.49 rows=2 width=16) (actual time=1.402..1.402 rows=0 loops=1)

111. 1.091 1.400 ↓ 0.0 0 1

Bitmap Heap Scan on tb_item_pedido_nova tb_item_pedido_nova_2 (cost=36.34..317.44 rows=3 width=16) (actual time=1.400..1.400 rows=0 loops=1)

  • Recheck Cond: (id_despesa_nova = 11)
  • Filter: (id_item_despesa_nova = 241)
  • Rows Removed by Filter: 1606
112. 0.309 0.309 ↑ 1.0 1,606 1

Bitmap Index Scan on idx_tb_item_pedido_nova_id_despesa_nova (cost=0.00..36.34 rows=1,607 width=0) (actual time=0.309..0.309 rows=1,606 loops=1)

  • Index Cond: (id_despesa_nova = 11)
113. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_pedido_alteracao on tb_pedido_alteracao plt_alt (cost=0.28..8.30 rows=1 width=8) (never executed)

  • Index Cond: (id_pedido_alteracao = tb_item_pedido_nova_2.id_pedido_alteracao)
  • Filter: (id_status_ped = 3)
114. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=175.52..248.85 rows=6 width=12) (never executed)

  • Hash Cond: (tb_plt_edicao_1.id_plt_entidade = plt_conv.id_plt_entidade)
115. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=167.00..196.31 rows=2,931 width=8) (never executed)

116. 0.000 0.000 ↓ 0.0 0

Seq Scan on tb_plt_edicao tb_plt_edicao_1 (cost=0.00..142.41 rows=4,918 width=8) (never executed)

  • Filter: (id_edicao_aditivo = 0)
117. 0.000 0.000 ↓ 0.0 0

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

118. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_plt_convenio_id_convenio on tb_plt_convenio plt_conv (cost=0.28..8.44 rows=6 width=4) (never executed)

  • Index Cond: (id_convenio = 2394)
119. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_plano_trabalho on tb_plt_entidade plt_ent (cost=0.28..0.38 rows=1 width=12) (never executed)

  • Index Cond: (id_plt_entidade = tb_plt_edicao_1.id_plt_entidade)
120. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_plt_edicao on tb_plt_edicao a_3 (cost=0.28..0.43 rows=1 width=12) (never executed)

  • Index Cond: (id_plt_edicao = (max(tb_plt_edicao_1.id_plt_edicao)))
121. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_item_plt_id_plt_edicao on tb_item_plt c_3 (cost=0.28..0.41 rows=1 width=74) (never executed)

  • Index Cond: (id_plt_edicao = a_3.id_plt_edicao)
122. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_subitem_plt_id_item_plt on tb_subitem_plt d_3 (cost=0.28..0.38 rows=1 width=27) (never executed)

  • Index Cond: (id_item_plt = c_3.id_item_plt)
123. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pk_tb_item_servico on tb_item_servico iser (cost=0.14..0.16 rows=1 width=4) (never executed)

  • Index Cond: (id_item_servico = plt_ent.id_item_servico)
  • Heap Fetches: 0
124. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_item_pedido_nova on tb_item_pedido_nova item_pedido_nova (cost=0.28..8.31 rows=1 width=18) (never executed)

  • Index Cond: (id_item_pedido_nova = (max(tb_item_pedido_nova_2.id_item_pedido_nova)))
  • Filter: (id_status_item_ped = 2)
125. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_desp_subitem_id_subitem_plt on tb_desp_subitem desp (cost=0.42..1.65 rows=23 width=18) (never executed)

  • Index Cond: (id_subitem_plt = d_3.id_subitem_plt)
126. 0.000 0.000 ↓ 0.0 0

Seq Scan on tb_despesa f (cost=0.00..1.14 rows=1 width=4) (never executed)

  • Filter: (id_despesa = 11)
127. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_id_item_despesa1 on tb_item_despesa k (cost=0.27..8.29 rows=1 width=8) (never executed)

  • Index Cond: (id_item_despesa = 241)
  • Filter: (id_despesa = 11)
128. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_fonte_recurso_ent on tb_fonte_recurso_sub j_2 (cost=0.13..0.16 rows=1 width=16) (never executed)

  • Index Cond: (id_fonte_recurso_sub = item_antigo.id_fonte_recurso)
129. 0.002 13.233 ↓ 0.0 0 1

Subquery Scan on *SELECT* 4 (cost=495.40..495.42 rows=1 width=54) (actual time=13.233..13.233 rows=0 loops=1)

130. 0.000 13.231 ↓ 0.0 0 1

HashAggregate (cost=495.40..495.41 rows=1 width=54) (actual time=13.231..13.231 rows=0 loops=1)

131. 0.002 13.231 ↓ 0.0 0 1

Nested Loop (cost=422.28..495.35 rows=1 width=54) (actual time=13.231..13.231 rows=0 loops=1)

  • Join Filter: (tb_item_pedido_antigo.id_despesa_ant = f_1.id_despesa)
132. 0.000 13.229 ↓ 0.0 0 1

Nested Loop (cost=422.15..495.16 rows=1 width=58) (actual time=13.229..13.229 rows=0 loops=1)

133. 0.001 13.229 ↓ 0.0 0 1

Nested Loop (cost=421.88..488.46 rows=1 width=50) (actual time=13.229..13.229 rows=0 loops=1)

  • Join Filter: (item_antigo_1.id_fonte_recurso = j_3.id_fonte_recurso_sub)
134. 0.001 13.228 ↓ 0.0 0 1

Nested Loop (cost=421.88..487.32 rows=1 width=38) (actual time=13.228..13.228 rows=0 loops=1)

135. 0.192 13.227 ↓ 0.0 0 1

Nested Loop (cost=421.59..479.45 rows=1 width=30) (actual time=13.227..13.227 rows=0 loops=1)

136. 0.268 12.291 ↓ 186.0 186 1

Nested Loop (cost=421.31..471.13 rows=1 width=24) (actual time=4.850..12.291 rows=186 loops=1)

137. 0.272 11.651 ↓ 186.0 186 1

Nested Loop (cost=421.17..470.96 rows=1 width=28) (actual time=4.840..11.651 rows=186 loops=1)

138. 0.347 10.821 ↓ 186.0 186 1

Nested Loop (cost=420.89..470.49 rows=1 width=28) (actual time=4.832..10.821 rows=186 loops=1)

  • Join Filter: (plt_alt_1.id_plt_entidade = plt_conv_1.id_plt_entidade)
  • Rows Removed by Join Filter: 930
139. 0.031 0.202 ↓ 6.0 6 1

Hash Join (cost=60.99..69.19 rows=1 width=12) (actual time=0.183..0.202 rows=6 loops=1)

  • Hash Cond: (plt_conv_1.id_plt_entidade = max_edicao.id_plt_entidade)
140. 0.021 0.021 ↑ 1.0 6 1

Index Scan using idx_tb_plt_convenio_id_convenio on tb_plt_convenio plt_conv_1 (cost=0.28..8.44 rows=6 width=4) (actual time=0.014..0.021 rows=6 loops=1)

  • Index Cond: (id_convenio = 2394)
141. 0.005 0.150 ↑ 1.5 6 1

Hash (cost=60.60..60.60 rows=9 width=8) (actual time=0.150..0.150 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
142. 0.001 0.145 ↑ 1.5 6 1

Subquery Scan on max_edicao (cost=60.42..60.60 rows=9 width=8) (actual time=0.141..0.145 rows=6 loops=1)

143. 0.028 0.144 ↑ 1.5 6 1

HashAggregate (cost=60.42..60.51 rows=9 width=8) (actual time=0.140..0.144 rows=6 loops=1)

144. 0.018 0.116 ↓ 1.3 12 1

Nested Loop (cost=0.56..60.38 rows=9 width=8) (actual time=0.024..0.116 rows=12 loops=1)

145. 0.014 0.014 ↑ 1.0 6 1

Index Scan using idx_tb_plt_convenio_id_convenio on tb_plt_convenio tb_plt_convenio_1 (cost=0.28..8.44 rows=6 width=4) (actual time=0.008..0.014 rows=6 loops=1)

  • Index Cond: (id_convenio = 2394)
146. 0.084 0.084 ↓ 2.0 2 6

Index Scan using idx_tb_plt_edicao_id_plt_entidade on tb_plt_edicao tb_plt_edicao_2 (cost=0.28..8.65 rows=1 width=8) (actual time=0.007..0.014 rows=2 loops=6)

  • Index Cond: (id_plt_entidade = tb_plt_convenio_1.id_plt_entidade)
  • Filter: (id_edicao_aditivo = 0)
  • Rows Removed by Filter: 3
147. 1.608 10.272 ↓ 93.0 186 6

Nested Loop (cost=359.90..401.28 rows=2 width=16) (actual time=0.767..1.712 rows=186 loops=6)

148. 0.847 5.082 ↓ 39.8 199 6

HashAggregate (cost=359.62..359.67 rows=5 width=16) (actual time=0.760..0.847 rows=199 loops=6)

149. 1.314 4.235 ↓ 74.6 373 1

Hash Join (cost=92.89..359.57 rows=5 width=16) (actual time=1.931..4.235 rows=373 loops=1)

  • Hash Cond: (tb_item_pedido_antigo.id_pedido_alteracao = tb_pedido_alteracao_1.id_pedido_alteracao)
150. 1.413 1.413 ↑ 1.0 4,752 1

Seq Scan on tb_item_pedido_antigo (cost=0.00..248.73 rows=4,773 width=16) (actual time=0.004..1.413 rows=4,752 loops=1)

151. 0.044 1.508 ↓ 30.2 121 1

Hash (cost=92.84..92.84 rows=4 width=4) (actual time=1.508..1.508 rows=121 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 5kB
152. 0.741 1.464 ↓ 30.2 121 1

Hash Join (cost=8.51..92.84 rows=4 width=4) (actual time=0.219..1.464 rows=121 loops=1)

  • Hash Cond: (tb_pedido_alteracao_1.id_plt_entidade = tb_plt_convenio_2.id_plt_entidade)
153. 0.710 0.710 ↑ 1.0 3,619 1

Seq Scan on tb_pedido_alteracao tb_pedido_alteracao_1 (cost=0.00..66.19 rows=3,619 width=8) (actual time=0.008..0.710 rows=3,619 loops=1)

154. 0.004 0.013 ↑ 1.0 6 1

Hash (cost=8.44..8.44 rows=6 width=4) (actual time=0.013..0.013 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
155. 0.009 0.009 ↑ 1.0 6 1

Index Scan using idx_tb_plt_convenio_id_convenio on tb_plt_convenio tb_plt_convenio_2 (cost=0.28..8.44 rows=6 width=4) (actual time=0.006..0.009 rows=6 loops=1)

  • Index Cond: (id_convenio = 2394)
156. 3.582 3.582 ↑ 1.0 1 1,194

Index Scan using pk_tb_pedido_alteracao on tb_pedido_alteracao plt_alt_1 (cost=0.28..8.30 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=1,194)

  • Index Cond: (id_pedido_alteracao = tb_item_pedido_antigo.id_pedido_alteracao)
  • Filter: (id_status_ped = 3)
  • Rows Removed by Filter: 0
157. 0.558 0.558 ↑ 1.0 1 186

Index Scan using pk_tb_plano_trabalho on tb_plt_entidade plt_ent_1 (cost=0.28..0.46 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=186)

  • Index Cond: (id_plt_entidade = plt_alt_1.id_plt_entidade)
158. 0.372 0.372 ↑ 1.0 1 186

Index Only Scan using pk_tb_item_servico on tb_item_servico iser_1 (cost=0.14..0.16 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=186)

  • Index Cond: (id_item_servico = plt_ent_1.id_item_servico)
  • Heap Fetches: 186
159. 0.744 0.744 ↓ 0.0 0 186

Index Scan using pk_tb_itens_pedido_alt on tb_item_pedido_antigo item_antigo_1 (cost=0.28..8.31 rows=1 width=14) (actual time=0.004..0.004 rows=0 loops=186)

  • Index Cond: (id_item_pedido_ant = (max(tb_item_pedido_antigo.id_item_pedido_ant)))
  • Filter: ((id_despesa_ant = 11) AND (id_item_despesa_ant = 241) AND (id_status_item_ped = 2))
  • Rows Removed by Filter: 1
160. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_plt_edicao on tb_plt_edicao a_4 (cost=0.28..7.86 rows=1 width=12) (never executed)

  • Index Cond: (id_plt_edicao = max_edicao.id_plt_edicao)
  • Filter: (id_status_plt = 5)
161. 0.000 0.000 ↓ 0.0 0

Seq Scan on tb_fonte_recurso_sub j_3 (cost=0.00..1.06 rows=6 width=16) (never executed)

162. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_id_item_despesa1 on tb_item_despesa k_1 (cost=0.27..6.70 rows=1 width=8) (never executed)

  • Index Cond: (id_item_despesa = tb_item_pedido_antigo.id_item_despesa_ant)
  • Filter: (tb_item_pedido_antigo.id_despesa_ant = id_despesa)
163. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pk_tb_despesas on tb_despesa f_1 (cost=0.14..0.18 rows=1 width=4) (never executed)

  • Index Cond: (id_despesa = k_1.id_despesa)
  • Heap Fetches: 0
164. 0.002 30.744 ↓ 0.0 0 1

Subquery Scan on *SELECT* 5 (cost=60.00..515.44 rows=1 width=135) (actual time=30.744..30.744 rows=0 loops=1)

165. 0.000 30.742 ↓ 0.0 0 1

Nested Loop (cost=60.00..515.43 rows=1 width=135) (actual time=30.742..30.742 rows=0 loops=1)

  • Join Filter: (ped.id_fonte_recurso_sub = j_4.id_fonte_recurso_sub)
166. 0.000 30.742 ↓ 0.0 0 1

Nested Loop (cost=60.00..514.30 rows=1 width=123) (actual time=30.742..30.742 rows=0 loops=1)

167. 0.002 30.742 ↓ 0.0 0 1

Nested Loop (cost=59.73..505.99 rows=1 width=131) (actual time=30.742..30.742 rows=0 loops=1)

168. 0.000 30.740 ↓ 0.0 0 1

Nested Loop (cost=59.73..504.85 rows=1 width=131) (actual time=30.740..30.740 rows=0 loops=1)

169. 0.000 30.740 ↓ 0.0 0 1

Nested Loop (cost=59.45..504.46 rows=1 width=108) (actual time=30.740..30.740 rows=0 loops=1)

  • Join Filter: ((min(tb_plt_edicao_3.id_plt_edicao)) = a_5.id_plt_edicao)
170. 0.001 30.740 ↓ 0.0 0 1

Nested Loop (cost=59.17..504.08 rows=1 width=104) (actual time=30.740..30.740 rows=0 loops=1)

171. 0.001 30.739 ↓ 0.0 0 1

Nested Loop (cost=58.88..495.77 rows=1 width=30) (actual time=30.739..30.739 rows=0 loops=1)

172. 0.000 30.738 ↓ 0.0 0 1

Nested Loop (cost=58.74..495.60 rows=1 width=34) (actual time=30.738..30.738 rows=0 loops=1)

173. 0.001 30.738 ↓ 0.0 0 1

Nested Loop (cost=58.46..495.13 rows=1 width=34) (actual time=30.738..30.738 rows=0 loops=1)

174. 0.042 30.737 ↓ 0.0 0 1

Nested Loop (cost=58.03..486.67 rows=1 width=38) (actual time=30.737..30.737 rows=0 loops=1)

  • Join Filter: (plt_conv_2.id_plt_entidade = ped_alt.id_plt_entidade)
175. 0.030 0.173 ↓ 6.0 6 1

Hash Join (cost=57.47..65.66 rows=1 width=12) (actual time=0.139..0.173 rows=6 loops=1)

  • Hash Cond: (plt_conv_2.id_plt_entidade = tb_plt_edicao_3.id_plt_entidade)
176. 0.025 0.025 ↑ 1.0 6 1

Index Scan using idx_tb_plt_convenio_id_convenio on tb_plt_convenio plt_conv_2 (cost=0.28..8.44 rows=6 width=4) (actual time=0.006..0.025 rows=6 loops=1)

  • Index Cond: (id_convenio = 2394)
177. 0.003 0.118 ↑ 1.0 6 1

Hash (cost=57.12..57.12 rows=6 width=8) (actual time=0.118..0.118 rows=6 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
178. 0.020 0.115 ↑ 1.0 6 1

HashAggregate (cost=57.00..57.06 rows=6 width=8) (actual time=0.111..0.115 rows=6 loops=1)

179. 0.010 0.095 ↓ 3.8 23 1

Nested Loop (cost=0.84..56.97 rows=6 width=8) (actual time=0.022..0.095 rows=23 loops=1)

180. 0.009 0.037 ↑ 1.0 6 1

Nested Loop (cost=0.56..54.30 rows=6 width=8) (actual time=0.012..0.037 rows=6 loops=1)

181. 0.004 0.004 ↑ 1.0 6 1

Index Scan using idx_tb_plt_convenio_id_convenio on tb_plt_convenio tb_plt_convenio_3 (cost=0.28..8.44 rows=6 width=4) (actual time=0.003..0.004 rows=6 loops=1)

  • Index Cond: (id_convenio = 2394)
182. 0.024 0.024 ↑ 1.0 1 6

Index Only Scan using pk_tb_plano_trabalho on tb_plt_entidade (cost=0.28..7.63 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=6)

  • Index Cond: (id_plt_entidade = tb_plt_convenio_3.id_plt_entidade)
  • Heap Fetches: 6
183. 0.048 0.048 ↓ 4.0 4 6

Index Scan using idx_tb_plt_edicao_id_plt_entidade on tb_plt_edicao tb_plt_edicao_3 (cost=0.28..0.43 rows=1 width=8) (actual time=0.004..0.008 rows=4 loops=6)

  • Index Cond: (id_plt_entidade = tb_plt_entidade.id_plt_entidade)
  • Filter: (id_status_plt = 5)
  • Rows Removed by Filter: 1
184. 0.006 30.522 ↓ 0.0 0 6

Nested Loop (cost=0.56..420.99 rows=1 width=26) (actual time=5.087..5.087 rows=0 loops=6)

185. 0.006 30.516 ↓ 0.0 0 6

Nested Loop (cost=0.28..412.68 rows=1 width=26) (actual time=5.086..5.086 rows=0 loops=6)

186. 30.510 30.510 ↓ 0.0 0 6

Seq Scan on tb_pdc_ped_alt ped (cost=0.00..404.36 rows=1 width=18) (actual time=5.085..5.085 rows=0 loops=6)

  • Filter: (id_item_pdc = 0)
  • Rows Removed by Filter: 21389
187. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_item_pedido_nova on tb_item_pedido_nova item_pedido_nova_1 (cost=0.28..8.31 rows=1 width=16) (never executed)

  • Index Cond: (id_item_pedido_nova = ped.id_item_ped_nova)
  • Filter: ((id_despesa_nova = 11) AND (id_item_despesa_nova = 241) AND (id_status_item_ped = 2))
188. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_pedido_alteracao on tb_pedido_alteracao ped_alt (cost=0.28..8.30 rows=1 width=8) (never executed)

  • Index Cond: (id_pedido_alteracao = item_pedido_nova_1.id_pedido_alteracao)
  • Filter: (id_status_ped = 3)
189. 0.000 0.000 ↓ 0.0 0

Index Only Scan using idx_tb_status_item_pdc_id_pdc_ped_alt on tb_status_item_pdc sti (cost=0.43..8.45 rows=1 width=4) (never executed)

  • Index Cond: (id_pdc_ped_alt = ped.id_pdc_ped_alt)
  • Heap Fetches: 0
190. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_plano_trabalho on tb_plt_entidade plt_ent_2 (cost=0.28..0.46 rows=1 width=12) (never executed)

  • Index Cond: (id_plt_entidade = ped_alt.id_plt_entidade)
191. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pk_tb_item_servico on tb_item_servico iser_2 (cost=0.14..0.16 rows=1 width=4) (never executed)

  • Index Cond: (id_item_servico = plt_ent_2.id_item_servico)
  • Heap Fetches: 0
192. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_item_plt_id_plt_edicao on tb_item_plt c_4 (cost=0.28..8.30 rows=1 width=74) (never executed)

  • Index Cond: (id_plt_edicao = (min(tb_plt_edicao_3.id_plt_edicao)))
193. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_tb_plt_edicao on tb_plt_edicao a_5 (cost=0.28..0.36 rows=1 width=12) (never executed)

  • Index Cond: (id_plt_edicao = c_4.id_plt_edicao)
  • Filter: (id_status_plt = 5)
194. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_tb_subitem_plt_id_item_plt on tb_subitem_plt d_4 (cost=0.28..0.38 rows=1 width=27) (never executed)

  • Index Cond: (id_item_plt = c_4.id_item_plt)
195. 0.000 0.000 ↓ 0.0 0

Seq Scan on tb_despesa f_2 (cost=0.00..1.14 rows=1 width=4) (never executed)

  • Filter: (id_despesa = 11)
196. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_id_item_despesa1 on tb_item_despesa k_2 (cost=0.27..8.29 rows=1 width=8) (never executed)

  • Index Cond: (id_item_despesa = 241)
  • Filter: (id_despesa = 11)
197. 0.000 0.000 ↓ 0.0 0

Seq Scan on tb_fonte_recurso_sub j_4 (cost=0.00..1.06 rows=6 width=16) (never executed)

198.          

SubPlan (forSubquery Scan)

199. 2.764 8.126 ↓ 1.1 3,180 1

GroupAggregate (cost=0.28..316.74 rows=2,931 width=8) (actual time=0.052..8.126 rows=3,180 loops=1)

200. 5.362 5.362 ↑ 1.0 4,917 1

Index Scan using idx_tb_plt_edicao_id_plt_entidade on tb_plt_edicao tb_plt_edicao_4 (cost=0.28..262.84 rows=4,918 width=8) (actual time=0.042..5.362 rows=4,917 loops=1)

  • Filter: (id_edicao_aditivo = 0)
  • Rows Removed by Filter: 716