From 66458f546829244b89a468eb00ea9caed60e0c29 Mon Sep 17 00:00:00 2001 From: Sushant Date: Mon, 11 Jul 2022 16:23:38 +1000 Subject: [PATCH] adding additional indexes for log_event and log_detail tables to allow for improved sorting on requests from admin UI --- ansible/roles/logger-service/files/db/schema.sql | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ansible/roles/logger-service/files/db/schema.sql b/ansible/roles/logger-service/files/db/schema.sql index 4657dd43e..c34dca735 100644 --- a/ansible/roles/logger-service/files/db/schema.sql +++ b/ansible/roles/logger-service/files/db/schema.sql @@ -239,4 +239,15 @@ SET character_set_client = @saved_cs_client; CREATE INDEX esbee_entity_uid ON event_summary_breakdown_email_entity (entity_uid(6)); CREATE INDEX esbre_entity_uid ON event_summary_breakdown_reason_entity (entity_uid(6)); -CREATE INDEX month_idx ON log_event (`month`); \ No newline at end of file +-- required indexes for log_event to allow faster/more efficient sorting. +CREATE INDEX month_idx ON log_event (`month`); +CREATE INDEX log_event_type_id_idx ON log_event (`log_event_type_id`); +CREATE INDEX log_source_type_id_idx ON log_event (`log_source_type_id`); +CREATE INDEX log_reason_type_id_idx ON log_event (`log_reason_type_id`); +CREATE INDEX user_email_idx ON log_event (`user_email`); +CREATE INDEX source_idx ON log_event (`source`); + +-- required indexes for log_detail to allow faster/more efficient sorting. +CREATE INDEX entity_type_idx ON log_event (`entity_type`); +CREATE INDEX entity_uid_idx ON log_event (`entity_uid`); +CREATE INDEX record_count_idx ON log_event (`record_count`);