-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add materialized view for resource utilization and refresh it
Co-authored-by: Thomas Krampl <[email protected]>
- Loading branch information
1 parent
fe853f9
commit 34baf0f
Showing
8 changed files
with
154 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
internal/database/migrations/0004_mat_view_resource_utilization.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-- +goose Up | ||
|
||
-- Team range for resource utilization | ||
DROP MATERIALIZED VIEW IF EXISTS resource_team_range; | ||
CREATE MATERIALIZED VIEW resource_team_range AS | ||
SELECT | ||
team_slug, | ||
MIN(timestamp)::timestamptz AS "from", | ||
MAX(timestamp)::timestamptz AS "to" | ||
FROM | ||
resource_utilization_metrics | ||
GROUP BY | ||
team_slug; | ||
|
||
CREATE UNIQUE INDEX ON resource_team_range (team_slug); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters