server - add indexes to host in order to make scheduler requests quick

for users with large number of devices (i.e at least 50k)
This commit is contained in:
Kevin Reed 2018-08-23 15:10:48 -05:00
parent 515620c9a3
commit 77f9078398
2 changed files with 12 additions and 1 deletions

View File

@ -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);

View File

@ -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")
);
?>