From 77f90783984219f06e2dfbea15b52555a1adf0e7 Mon Sep 17 00:00:00 2001 From: Kevin Reed Date: Thu, 23 Aug 2018 15:10:48 -0500 Subject: [PATCH] server - add indexes to host in order to make scheduler requests quick for users with large number of devices (i.e at least 50k) --- db/constraints.sql | 4 ++++ html/ops/db_update.php | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/db/constraints.sql b/db/constraints.sql index c7eb61fb20..d1f8646df4 100644 --- a/db/constraints.sql +++ b/db/constraints.sql @@ -83,6 +83,10 @@ alter table msg_to_host alter table host add index host_user (userid), -- html_user/host_user.php + add index host_cpid (host_cpid), + -- scheduler request for user with many hosts + add index host_domain_name (domain_name), + -- scheduler request for user with many hosts add index host_avg (expavg_credit desc), -- db_dump.C add index host_tot (total_credit desc); diff --git a/html/ops/db_update.php b/html/ops/db_update.php index fab81b8284..7fd14ad2a9 100644 --- a/html/ops/db_update.php +++ b/html/ops/db_update.php @@ -1162,6 +1162,12 @@ function update_5_9_2018() { "); } +function update_8_23_2018() { + $retval = do_query("alter table host add index host_cpid (host_cpid)"); + return $retval && do_query("alter table host add index host_domain_name (domain_name)"); +} + + // Updates are done automatically if you use "upgrade". // // If you need to do updates manually, @@ -1219,7 +1225,8 @@ $db_updates = array ( array(27023, "update_4_6_2018"), array(27024, "update_4_18_2018"), array(27025, "update_4_19_2018"), - array(27026, "update_5_9_2018") + array(27026, "update_5_9_2018"), + array(27027, "update_8_23_2018") ); ?>