Skip to content

Commit

Permalink
Filter scad from views for perfomance (#812)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarmist authored May 15, 2024
1 parent 46d8c08 commit 6b7eae2
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 23 deletions.
5 changes: 4 additions & 1 deletion cid/builtin/core/data/queries/cid/summary_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,8 @@
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
FROM
"${cur_table_name}"
WHERE (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))
WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
6 changes: 4 additions & 2 deletions cid/builtin/core/data/queries/cid/summary_view_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
FROM
"${cur_table_name}"
WHERE (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))

WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
6 changes: 4 additions & 2 deletions cid/builtin/core/data/queries/cid/summary_view_sp.sql
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
FROM
"${cur_table_name}"
WHERE (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))

WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
6 changes: 4 additions & 2 deletions cid/builtin/core/data/queries/cid/summary_view_sp_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
FROM
"${cur_table_name}"
WHERE (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))

WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/hourly_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
, "sum"("line_item_usage_amount") "usage_quantity"
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/hourly_view_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
, "sum"("line_item_usage_amount") "usage_quantity"
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/hourly_view_sp.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
, "sum"("line_item_usage_amount") "usage_quantity"
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/hourly_view_sp_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
, "sum"("line_item_usage_amount") "usage_quantity"
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/resource_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
, "sum"("line_item_unblended_cost") unblended_cost
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND (line_item_resource_id <> '')
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/resource_view_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
, "sum"("line_item_unblended_cost") unblended_cost
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND (line_item_resource_id <> '')
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/resource_view_sp.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
, "sum"("line_item_unblended_cost") unblended_cost
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND (line_item_resource_id <> '')
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/resource_view_sp_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
, "sum"("line_item_unblended_cost") unblended_cost
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND (line_item_resource_id <> '')
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29

0 comments on commit 6b7eae2

Please sign in to comment.