From dc2b1a39aa1af94896badd3ccf76fc6b57f91de0 Mon Sep 17 00:00:00 2001 From: Suraj Patil Date: Mon, 25 Sep 2023 14:37:28 +0530 Subject: [PATCH] Added index to workload_metrics table --- migrations/000006_create_workload_metrics_table.up.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/migrations/000006_create_workload_metrics_table.up.sql b/migrations/000006_create_workload_metrics_table.up.sql index deb6c5e0..8707a278 100644 --- a/migrations/000006_create_workload_metrics_table.up.sql +++ b/migrations/000006_create_workload_metrics_table.up.sql @@ -15,6 +15,7 @@ ON DELETE CASCADE; ALTER TABLE workload_metrics ADD CONSTRAINT UQ_Workload_Metrics UNIQUE (org_id, workload_id, container_name, interval_start, interval_end); +CREATE INDEX IF NOT EXISTS idx_workload_metrics_workload_id_interval_end ON workload_metrics(workload_id, interval_end); CREATE OR REPLACE FUNCTION workload_metrics_insert_trigger_func() RETURNS trigger AS $BODY$