From 673094950c05181edfbe2e5b3f35fc22a70f2baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 20 Apr 2024 10:20:25 +0200 Subject: [PATCH] feat: curioweb: Improve task_history indexes --- lib/harmony/harmonydb/sql/20240317-web-summary-index.sql | 5 +++-- lib/harmony/harmonydb/sql/20240420-web-task-indexes.sql | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 lib/harmony/harmonydb/sql/20240420-web-task-indexes.sql diff --git a/lib/harmony/harmonydb/sql/20240317-web-summary-index.sql b/lib/harmony/harmonydb/sql/20240317-web-summary-index.sql index 28902448d05..86f4591c1ea 100644 --- a/lib/harmony/harmonydb/sql/20240317-web-summary-index.sql +++ b/lib/harmony/harmonydb/sql/20240317-web-summary-index.sql @@ -1,6 +1,7 @@ /* Used for webui clusterMachineSummary */ -CREATE INDEX harmony_task_history_work_index - ON harmony_task_history (completed_by_host_and_port ASC, name ASC, result ASC, work_end DESC); +-- NOTE: This index is changed in 20240420-web-task-indexes.sql +-- CREATE INDEX harmony_task_history_work_index +-- ON harmony_task_history (completed_by_host_and_port ASC, name ASC, result ASC, work_end DESC); /* Used for webui actorSummary sp wins */ CREATE INDEX mining_tasks_won_sp_id_base_compute_time_index diff --git a/lib/harmony/harmonydb/sql/20240420-web-task-indexes.sql b/lib/harmony/harmonydb/sql/20240420-web-task-indexes.sql new file mode 100644 index 00000000000..264917a1e7b --- /dev/null +++ b/lib/harmony/harmonydb/sql/20240420-web-task-indexes.sql @@ -0,0 +1,9 @@ +drop index harmony_task_history_work_index; + +/* + This structure improves clusterMachineSummary query better than the old version, + while at the same time also being usable by clusterTaskHistorySummary (which wasn't + the case with the old index). + */ +create index harmony_task_history_work_index + on harmony_task_history (work_end desc, completed_by_host_and_port asc, name asc, result asc);