explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Wxkv

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 19,806.061 ↓ 5.0 5 1

Limit (cost=5,975.68..164,188.18 rows=1 width=1,038) (actual time=19,482.541..19,806.061 rows=5 loops=1)

2.          

CTE params

3. 0.002 0.002 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=40) (actual time=0.001..0.002 rows=1 loops=1)

4.          

CTE get_all_funds

5. 1,503.082 19,276.178 ↓ 5.0 5 1

GroupAggregate (cost=5,573.86..5,576.06 rows=1 width=243) (actual time=19,260.663..19,276.178 rows=5 loops=1)

  • Group Key: tb_asset_fund.id_fund, (trunc(tb_asset_fund.performance_prefixed_rate, 2)), (trunc(tb_asset_fund.performance_index_reference_rate, 2)), (CASE WHEN (tb_asset_fund.id_benchmark = 99) THEN ((S
6.          

Initplan (for GroupAggregate)

7. 0.001 0.001 ↑ 1.0 1 1

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

8. 0.005 0.005 ↑ 1.0 1 1

CTE Scan on params params_1 (cost=0.00..0.02 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=1)

9. 0.001 0.001 ↑ 1.0 1 1

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

10. 5,230.786 17,773.089 ↓ 2,500,982.0 2,500,982 1

Sort (cost=5,573.80..5,573.81 rows=1 width=219) (actual time=15,450.253..17,773.089 rows=2,500,982 loops=1)

  • Sort Key: tb_asset_fund.id_fund, (trunc(tb_asset_fund.performance_prefixed_rate, 2)), (trunc(tb_asset_fund.performance_index_reference_rate, 2)), (CASE WHEN (tb_asset_fund.id_benchmark = 99) THE
  • Sort Method: external merge Disk: 347576kB
11. 5,696.931 12,542.303 ↓ 2,500,982.0 2,500,982 1

Nested Loop Left Join (cost=1.70..5,573.79 rows=1 width=219) (actual time=0.164..12,542.303 rows=2,500,982 loops=1)

12. 0.047 0.428 ↓ 5.0 5 1

Nested Loop Left Join (cost=1.14..5,278.78 rows=1 width=128) (actual time=0.116..0.428 rows=5 loops=1)

  • Join Filter: (tb_asset_fund.id_administrator = tb_asset_administrators.id_administrator)
  • Rows Removed by Join Filter: 165
13. 0.018 0.336 ↓ 5.0 5 1

Nested Loop (cost=1.14..5,276.97 rows=1 width=100) (actual time=0.092..0.336 rows=5 loops=1)

  • Join Filter: (tb_asset_fund.id_portfolio = tb_as_portfolio.id_portfolio)
  • Rows Removed by Join Filter: 20
14. 0.023 0.148 ↓ 5.0 5 1

Nested Loop (cost=0.71..28.33 rows=1 width=98) (actual time=0.056..0.148 rows=5 loops=1)

15. 0.050 0.050 ↓ 2.5 5 1

Index Only Scan using tb_asset_investor_fund_pk on tb_asset_investors_fund (cost=0.29..11.43 rows=2 width=4) (actual time=0.032..0.050 rows=5 loops=1)

  • Index Cond: ((id_asset = $5) AND (id_investor = $4))
  • Heap Fetches: 5
16. 0.075 0.075 ↑ 1.0 1 5

Index Scan using tb_asset_fund_id_asset_ix on tb_asset_fund (cost=0.43..8.45 rows=1 width=98) (actual time=0.015..0.015 rows=1 loops=5)

  • Index Cond: ((id_asset = $6) AND (id_fund = tb_asset_investors_fund.id_fund))
  • Filter: ((status)::text = 'A'::text)
17. 0.170 0.170 ↑ 155.6 5 5

Index Scan using tb_as_portfolio_idx3 on tb_as_portfolio (cost=0.43..5,238.91 rows=778 width=18) (actual time=0.020..0.034 rows=5 loops=5)

  • Index Cond: (id_asset = $6)
  • Filter: ((COALESCE(tp_portfolio_view, 'REAL'::character varying))::text = ANY ('{REAL,CONS}'::text[]))
  • Rows Removed by Filter: 3
18. 0.045 0.045 ↑ 1.1 34 5

Seq Scan on tb_asset_administrators (cost=0.00..1.36 rows=36 width=36) (actual time=0.006..0.009 rows=34 loops=5)

19. 1,842.980 1,842.980 ↓ 1,479.9 500,196 5

Index Scan using tb_as_issues_id_contract_id_portfolio_tp_issue_idx on tb_as_issues (cost=0.56..289.47 rows=338 width=18) (actual time=0.020..368.596 rows=500,196 loops=5)

  • Index Cond: ((id_contract = tb_as_portfolio.id_contract) AND (id_portfolio = tb_asset_fund.id_portfolio))
  • Filter: (dh_investor_ok IS NULL)
  • Rows Removed by Filter: 6936
20.          

SubPlan (for Nested Loop Left Join)

21. 0.000 0.000 ↓ 0.0 0

Seq Scan on tb_as_custom_benchmark (cost=0.00..1.02 rows=1 width=32) (never executed)

  • Filter: ((id_asset = tb_asset_fund.id_asset) AND (id_custom_benchmark = tb_asset_fund.id_custom_benchmark))
22. 5,001.964 5,001.964 ↑ 1.0 1 2,500,982

Seq Scan on tb_as_benchmark (cost=0.00..1.14 rows=1 width=118) (actual time=0.001..0.002 rows=1 loops=2,500,982)

  • Filter: (id_benchmark = tb_asset_fund.id_benchmark)
  • Rows Removed by Filter: 10
23.          

CTE get_bdi_data

24. 0.405 19,354.140 ↓ 5.0 5 1

Nested Loop (cost=3.12..399.58 rows=1 width=911) (actual time=19,316.128..19,354.140 rows=5 loops=1)

25.          

Initplan (for Nested Loop)

26. 0.002 0.002 ↑ 1.0 1 1

CTE Scan on params params_43 (cost=0.00..0.02 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)

27. 19,302.249 19,302.249 ↓ 5.0 5 1

CTE Scan on get_all_funds gaf (cost=0.00..0.02 rows=1 width=380) (actual time=19,286.644..19,302.249 rows=5 loops=1)

28. 0.000 0.030 ↑ 1.0 1 5

Index Scan using tb_as_posi_day_pk on tb_as_posi_day pd (cost=3.10..11.13 rows=1 width=37) (actual time=0.006..0.006 rows=1 loops=5)

  • Index Cond: ((id_contract = $73) AND (id_portfolio = gaf.id_portfolio) AND (dt_posi = (SubPlan 74)))
29.          

SubPlan (for Index Scan)

30. 0.008 0.170 ↑ 1.0 1 5

Result (cost=2.53..2.54 rows=1 width=4) (actual time=0.034..0.034 rows=1 loops=5)

31.          

Initplan (for Result)

32. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_44 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

33. 0.001 0.001 ↑ 1.0 1 1

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

34. 0.020 0.160 ↑ 1.0 1 5

Limit (cost=0.56..2.49 rows=1 width=4) (actual time=0.032..0.032 rows=1 loops=5)

35. 0.140 0.140 ↑ 55.0 1 5

Index Only Scan Backward using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_12 (cost=0.56..106.33 rows=55 width=4) (actual time=0.028..0.028 rows=1 loops=5)

  • Index Cond: ((id_contract = $74) AND (id_portfolio = gaf.id_portfolio) AND (dt_posi IS NOT NULL) AND (dt_posi <= $75))
  • Heap Fetches: 8
36.          

SubPlan (for Nested Loop)

37. 0.008 0.070 ↑ 1.0 1 5

Limit (cost=0.60..2.60 rows=1 width=30) (actual time=0.014..0.014 rows=1 loops=5)

38.          

Initplan (for Limit)

39. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_3 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

40. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_4 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

41. 0.060 0.060 ↑ 53.0 1 5

Index Scan Backward using tb_as_posi_day_pk on tb_as_posi_day (cost=0.56..106.47 rows=53 width=30) (actual time=0.012..0.012 rows=1 loops=5)

  • Index Cond: ((id_contract = $11) AND (id_portfolio = pd.id_portfolio) AND (dt_posi <= $12))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
42. 0.008 0.075 ↑ 1.0 1 5

Limit (cost=0.60..2.60 rows=1 width=30) (actual time=0.015..0.015 rows=1 loops=5)

43.          

Initplan (for Limit)

44. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_5 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

45. 0.001 0.001 ↑ 1.0 1 1

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

46. 0.065 0.065 ↑ 53.0 1 5

Index Scan Backward using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_1 (cost=0.56..106.47 rows=53 width=30) (actual time=0.013..0.013 rows=1 loops=5)

  • Index Cond: ((id_contract = $14) AND (id_portfolio = pd.id_portfolio) AND (dt_posi < $15))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
47. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.62..8.66 rows=1 width=30) (never executed)

48.          

Initplan (for Limit)

49. 0.000 0.000 ↓ 0.0 0

CTE Scan on params params_7 (cost=0.00..0.02 rows=1 width=4) (never executed)

50. 0.000 0.000 ↓ 0.0 0

CTE Scan on params params_8 (cost=0.00..0.02 rows=1 width=4) (never executed)

51. 0.000 0.000 ↓ 0.0 0

CTE Scan on params params_9 (cost=0.00..0.02 rows=1 width=4) (never executed)

52. 0.000 0.000 ↓ 0.0 0

Index Scan using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_2 (cost=0.56..8.60 rows=1 width=30) (never executed)

  • Index Cond: ((id_contract = $17) AND (id_portfolio = pd.id_portfolio) AND (dt_posi >= $18) AND (dt_posi < $19))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
53. 0.008 0.065 ↑ 1.0 1 5

Limit (cost=0.60..2.60 rows=1 width=30) (actual time=0.013..0.013 rows=1 loops=5)

54.          

Initplan (for Limit)

55. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_10 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

56. 0.001 0.001 ↑ 1.0 1 1

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

57. 0.055 0.055 ↑ 53.0 1 5

Index Scan Backward using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_3 (cost=0.56..106.47 rows=53 width=30) (actual time=0.011..0.011 rows=1 loops=5)

  • Index Cond: ((id_contract = $21) AND (id_portfolio = pd.id_portfolio) AND (dt_posi < $22))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
58. 0.003 0.016 ↑ 1.0 1 1

Limit (cost=0.62..8.66 rows=1 width=30) (actual time=0.015..0.016 rows=1 loops=1)

59.          

Initplan (for Limit)

60. 0.003 0.003 ↑ 1.0 1 1

CTE Scan on params params_12 (cost=0.00..0.02 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=1)

61. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_13 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

62. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_14 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

63. 0.008 0.008 ↑ 1.0 1 1

Index Scan using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_4 (cost=0.56..8.60 rows=1 width=30) (actual time=0.008..0.008 rows=1 loops=1)

  • Index Cond: ((id_contract = $24) AND (id_portfolio = pd.id_portfolio) AND (dt_posi >= $25) AND (dt_posi < $26))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
64. 0.008 0.075 ↑ 1.0 1 5

Limit (cost=0.60..2.60 rows=1 width=30) (actual time=0.015..0.015 rows=1 loops=5)

65.          

Initplan (for Limit)

66. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_15 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

67. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_16 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

68. 0.065 0.065 ↑ 53.0 1 5

Index Scan Backward using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_5 (cost=0.56..106.47 rows=53 width=30) (actual time=0.013..0.013 rows=1 loops=5)

  • Index Cond: ((id_contract = $28) AND (id_portfolio = pd.id_portfolio) AND (dt_posi < $29))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
69. 0.014 0.036 ↑ 1.0 1 2

Limit (cost=0.62..8.66 rows=1 width=30) (actual time=0.017..0.018 rows=1 loops=2)

70.          

Initplan (for Limit)

71. 0.002 0.002 ↑ 1.0 1 1

CTE Scan on params params_17 (cost=0.00..0.02 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)

72. 0.001 0.001 ↑ 1.0 1 1

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

73. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_19 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

74. 0.018 0.018 ↑ 1.0 1 2

Index Scan using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_6 (cost=0.56..8.60 rows=1 width=30) (actual time=0.009..0.009 rows=1 loops=2)

  • Index Cond: ((id_contract = $31) AND (id_portfolio = pd.id_portfolio) AND (dt_posi >= $32) AND (dt_posi < $33))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
75. 0.008 0.060 ↑ 1.0 1 5

Limit (cost=0.60..2.60 rows=1 width=30) (actual time=0.012..0.012 rows=1 loops=5)

76.          

Initplan (for Limit)

77. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_20 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

78. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_21 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

79. 0.050 0.050 ↑ 53.0 1 5

Index Scan Backward using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_7 (cost=0.56..106.47 rows=53 width=30) (actual time=0.010..0.010 rows=1 loops=5)

  • Index Cond: ((id_contract = $35) AND (id_portfolio = pd.id_portfolio) AND (dt_posi < $36))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
80. 0.002 0.010 ↑ 1.0 1 1

Limit (cost=0.62..8.66 rows=1 width=30) (actual time=0.010..0.010 rows=1 loops=1)

81.          

Initplan (for Limit)

82. 0.001 0.001 ↑ 1.0 1 1

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

83. 0.001 0.001 ↑ 1.0 1 1

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

84. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_24 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

85. 0.005 0.005 ↑ 1.0 1 1

Index Scan using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_8 (cost=0.56..8.60 rows=1 width=30) (actual time=0.005..0.005 rows=1 loops=1)

  • Index Cond: ((id_contract = $38) AND (id_portfolio = pd.id_portfolio) AND (dt_posi >= $39) AND (dt_posi < $40))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
86. 0.008 0.050 ↑ 1.0 1 5

Limit (cost=0.60..2.60 rows=1 width=30) (actual time=0.010..0.010 rows=1 loops=5)

87.          

Initplan (for Limit)

88. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_25 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

89. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_26 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

90. 0.040 0.040 ↑ 53.0 1 5

Index Scan Backward using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_9 (cost=0.56..106.47 rows=53 width=30) (actual time=0.008..0.008 rows=1 loops=5)

  • Index Cond: ((id_contract = $42) AND (id_portfolio = pd.id_portfolio) AND (dt_posi < $43))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
91. 0.003 0.022 ↑ 1.0 1 2

Limit (cost=0.62..8.66 rows=1 width=30) (actual time=0.011..0.011 rows=1 loops=2)

92.          

Initplan (for Limit)

93. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_27 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

94. 0.001 0.001 ↑ 1.0 1 1

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

95. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_29 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

96. 0.016 0.016 ↑ 1.0 1 2

Index Scan using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_10 (cost=0.56..8.60 rows=1 width=30) (actual time=0.008..0.008 rows=1 loops=2)

  • Index Cond: ((id_contract = $45) AND (id_portfolio = pd.id_portfolio) AND (dt_posi >= $46) AND (dt_posi < $47))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
97. 0.267 2.265 ↑ 1.0 1 5

Aggregate (cost=8.66..8.68 rows=1 width=32) (actual time=0.453..0.453 rows=1 loops=5)

98.          

Initplan (for Aggregate)

99. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_30 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

100. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_31 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

101. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_32 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

102. 1.995 1.995 ↓ 186.0 186 5

Index Scan using tb_as_posi_day_pk on tb_as_posi_day tb_as_posi_day_11 (cost=0.56..8.60 rows=1 width=7) (actual time=0.010..0.399 rows=186 loops=5)

  • Index Cond: ((id_contract = $49) AND (id_portfolio = pd.id_portfolio) AND (dt_posi >= $50) AND (dt_posi <= $51))
  • Filter: ((vl_quote_net <> '0'::numeric) AND (vl_net_worth > '0'::numeric))
103. 0.059 0.060 ↑ 1.0 1 5

Index Scan using tb_as_portfolio_pk on tb_as_portfolio tb_as_portfolio_1 (cost=0.45..8.47 rows=1 width=5) (actual time=0.011..0.012 rows=1 loops=5)

  • Index Cond: ((id_contract = $53) AND (id_portfolio = pd.id_portfolio))
104.          

Initplan (for Index Scan)

105. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_33 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

106. 0.024 0.025 ↑ 1.0 1 5

Index Scan using tb_as_portfolio_pk on tb_as_portfolio tb_as_portfolio_2 (cost=0.45..8.47 rows=1 width=32) (actual time=0.004..0.005 rows=1 loops=5)

  • Index Cond: ((id_contract = $55) AND (id_portfolio = pd.id_portfolio))
107.          

Initplan (for Index Scan)

108. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_34 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

109. 0.014 0.015 ↑ 1.0 1 5

Index Scan using tb_as_portfolio_pk on tb_as_portfolio tb_as_portfolio_3 (cost=0.45..8.47 rows=1 width=3) (actual time=0.003..0.003 rows=1 loops=5)

  • Index Cond: ((id_contract = $57) AND (id_portfolio = pd.id_portfolio))
110.          

Initplan (for Index Scan)

111. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_35 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

112. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=70.20..70.21 rows=1 width=4) (never executed)

113.          

Initplan (for Aggregate)

114. 0.000 0.000 ↓ 0.0 0

CTE Scan on params params_36 (cost=0.00..0.02 rows=1 width=4) (never executed)

115. 0.000 0.000 ↓ 0.0 0

Index Scan using tb_as_pending_processing_pk on tb_as_pending_processing (cost=0.29..70.09 rows=34 width=4) (never executed)

  • Index Cond: ((id_contract = $59) AND (id_portfolio = pd.id_portfolio))
  • Filter: (NOT is_processing)
116. 0.009 24.740 ↑ 1.0 1 5

Limit (cost=107.60..107.61 rows=1 width=40) (actual time=4.947..4.948 rows=1 loops=5)

117.          

Initplan (for Limit)

118. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_37 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

119. 0.425 24.730 ↑ 22.0 1 5

Sort (cost=107.58..107.64 rows=22 width=40) (actual time=4.946..4.946 rows=1 loops=5)

  • Sort Key: tb_as_process_request.dh_start DESC
  • Sort Method: top-N heapsort Memory: 25kB
120. 24.305 24.305 ↓ 19.3 424 5

Index Scan using tb_as_process_request_pk on tb_as_process_request (cost=0.43..107.47 rows=22 width=40) (actual time=2.690..4.861 rows=424 loops=5)

  • Index Cond: ((id_contract = $61) AND (id_portfolio = pd.id_portfolio) AND ((request_type)::text = 'PROCC'::text))
121. 0.008 23.530 ↑ 1.0 1 5

Limit (cost=107.66..107.66 rows=1 width=40) (actual time=4.706..4.706 rows=1 loops=5)

122.          

Initplan (for Limit)

123. 0.002 0.002 ↑ 1.0 1 1

CTE Scan on params params_38 (cost=0.00..0.02 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)

124. 0.470 23.520 ↑ 22.0 1 5

Sort (cost=107.64..107.69 rows=22 width=40) (actual time=4.704..4.704 rows=1 loops=5)

  • Sort Key: tb_as_process_request_1.dh_start DESC
  • Sort Method: top-N heapsort Memory: 25kB
125. 23.050 23.050 ↓ 19.3 424 5

Index Scan using tb_as_process_request_pk on tb_as_process_request tb_as_process_request_1 (cost=0.43..107.53 rows=22 width=40) (actual time=2.326..4.610 rows=424 loops=5)

  • Index Cond: ((id_contract = $63) AND (id_portfolio = pd.id_portfolio) AND ((request_type)::text = 'PROCC'::text))
126. 0.008 0.115 ↑ 1.0 1 5

Limit (cost=0.45..2.82 rows=1 width=40) (actual time=0.023..0.023 rows=1 loops=5)

127.          

Initplan (for Limit)

128. 0.002 0.002 ↑ 1.0 1 1

CTE Scan on params params_39 (cost=0.00..0.02 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1)

129. 0.105 0.105 ↑ 1,291.0 1 5

Index Scan using tb_as_process_request_con_por_start_idx on tb_as_process_request tb_as_process_request_2 (cost=0.43..3,057.98 rows=1,291 width=40) (actual time=0.021..0.021 rows=1 loops=5)

  • Index Cond: ((id_contract = $65) AND (id_portfolio = pd.id_portfolio))
  • Filter: ((request_type)::text = 'PROC'::text)
  • Rows Removed by Filter: 2
130. 0.009 0.055 ↑ 1.0 1 5

Limit (cost=0.45..2.82 rows=1 width=40) (actual time=0.010..0.011 rows=1 loops=5)

131.          

Initplan (for Limit)

132. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_40 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

133. 0.045 0.045 ↑ 1,291.0 1 5

Index Scan using tb_as_process_request_con_por_start_idx on tb_as_process_request tb_as_process_request_3 (cost=0.43..3,061.21 rows=1,291 width=40) (actual time=0.009..0.009 rows=1 loops=5)

  • Index Cond: ((id_contract = $67) AND (id_portfolio = pd.id_portfolio))
  • Filter: ((request_type)::text = 'PROC'::text)
  • Rows Removed by Filter: 2
134. 0.009 0.105 ↑ 1.0 1 5

Limit (cost=0.45..2.16 rows=1 width=40) (actual time=0.021..0.021 rows=1 loops=5)

135.          

Initplan (for Limit)

136. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on params params_41 (cost=0.00..0.02 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1)

137. 0.095 0.095 ↑ 773.0 1 5

Index Scan using tb_as_compliance_request_con_por_run_start_idx on tb_as_compliance_request (cost=0.42..1,327.92 rows=773 width=40) (actual time=0.019..0.019 rows=1 loops=5)

  • Index Cond: ((id_contract = $69) AND (id_portfolio = pd.id_portfolio) AND ((run_type)::text = 'POS'::text))
138. 0.059 0.065 ↑ 1.0 1 5

Limit (cost=0.45..2.16 rows=1 width=40) (actual time=0.013..0.013 rows=1 loops=5)

  • -> Index Scan using tb_as_compliance_request_con_por_run_start_idx on tb_as_compliance_request tb_as_compliance_request_1 (cost=0.42..1329.85 rows=773 width=40) (actual time=0.011..0.011 row
139.          

Initplan (for Limit)

140. 0.006 0.006 ↑ 1.0 1 1

CTE Scan on params params_42 (cost=0.00..0.02 rows=1 width=4) (actual time=0.006..0.006 rows=1 loops=1)

  • Index Cond: ((id_contract = $71) AND (id_portfolio = pd.id_portfolio) AND ((run_type)::text = 'POS'::text))
141. 0.094 19,806.056 ↓ 5.0 5 1

Result (cost=0.03..158,212.53 rows=1 width=1,038) (actual time=19,482.539..19,806.056 rows=5 loops=1)

142. 15.790 19,404.042 ↓ 5.0 5 1

Sort (cost=0.03..0.04 rows=1 width=948) (actual time=19,404.038..19,404.042 rows=5 loops=1)

  • Sort Key: gbd.classe_interna, gbd.nm_fund
  • Sort Method: quicksort Memory: 19570kB
143. 19,388.252 19,388.252 ↓ 5.0 5 1

CTE Scan on get_bdi_data gbd (cost=0.00..0.02 rows=1 width=948) (actual time=19,350.118..19,388.252 rows=5 loops=1)

144.          

SubPlan (for Result)

145. 366.662 401.590 ↓ 0.0 0 5

Bitmap Heap Scan on tb_as_instrument_posi_day ipd (cost=787.57..158,205.29 rows=1 width=6) (actual time=80.318..80.318 rows=0 loops=5)

  • Recheck Cond: (id_instrument = 299906)
  • Filter: ((id_portfolio = gbd.id_portfolio) AND (dt_posi = $80))
  • Rows Removed by Filter: 46926
  • Heap Blocks: exact=159225
146.          

Initplan (for Bitmap Heap Scan)

147. 0.003 0.003 ↑ 1.0 1 1

CTE Scan on params params_46 (cost=0.00..0.02 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=1)

148. 34.925 34.925 ↓ 1.1 46,928 5

Bitmap Index Scan on idx_instrument_posi_day (cost=0.00..787.55 rows=42,530 width=0) (actual time=6.985..6.985 rows=46,928 loops=5)

  • Index Cond: (id_instrument = 299906)
149. 0.035 0.100 ↑ 1.0 1 5

Aggregate (cost=1.79..1.80 rows=1 width=32) (actual time=0.019..0.020 rows=1 loops=5)

150. 0.065 0.065 ↓ 0.0 0 5

Seq Scan on tb_as_group g (cost=0.00..1.78 rows=1 width=22) (actual time=0.013..0.013 rows=0 loops=5)

  • Filter: ((gbd.id_asset = id_asset) AND ((cd_group_type)::text = '27'::text))
  • Rows Removed by Filter: 52
151. 0.020 0.230 ↑ 1.0 1 5

Aggregate (cost=5.39..5.40 rows=1 width=32) (actual time=0.046..0.046 rows=1 loops=5)

152. 0.045 0.210 ↓ 0.0 0 5

Hash Right Join (cost=3.71..5.38 rows=1 width=34) (actual time=0.042..0.042 rows=0 loops=5)

  • Hash Cond: (tb_as_group.id_group = gp.id_group)
153. 0.000 0.000 ↓ 0.0 0

Seq Scan on tb_as_group (cost=0.00..1.52 rows=52 width=26) (never executed)

154. 0.010 0.165 ↓ 0.0 0 5

Hash (cost=3.70..3.70 rows=1 width=12) (actual time=0.033..0.033 rows=0 loops=5)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
155. 0.155 0.155 ↓ 0.0 0 5

Seq Scan on tb_as_group_portfolio gp (cost=0.00..3.70 rows=1 width=12) (actual time=0.031..0.031 rows=0 loops=5)

  • Filter: ((id_contract = gbd.id_contract) AND (id_portfolio = gbd.id_portfolio))
  • Rows Removed by Filter: 180
Planning time : 6.106 ms
Execution time : 19,895.433 ms