Commit 4c147b21 authored by Leigh B Stoller's avatar Leigh B Stoller

Add index and use "force index" in query; drops "more entries" time

from 20 seconds to under 1.
parent e8bb25b3
...@@ -3681,7 +3681,8 @@ CREATE TABLE `testbed_stats` ( ...@@ -3681,7 +3681,8 @@ CREATE TABLE `testbed_stats` (
KEY `rsrcidx` (`rsrcidx`), KEY `rsrcidx` (`rsrcidx`),
KEY `exptidx` (`exptidx`), KEY `exptidx` (`exptidx`),
KEY `uid_idx` (`uid_idx`), KEY `uid_idx` (`uid_idx`),
KEY `idxdate` (`end_time`,`idx`) KEY `idxdate` (`end_time`,`idx`),
KEY `end_time` (`end_time`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --
......
#
# Add key to testbed_stats
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBKeyExists("testbed_stats", "end_time")) {
DBQueryFatal("ALTER TABLE testbed_stats " .
"ADD KEY `end_time` (`end_time`)");
}
return 0;
}
1;
...@@ -194,7 +194,7 @@ $query_result = ...@@ -194,7 +194,7 @@ $query_result =
DBQueryFatal("select t.exptidx,s.pid,s.eid,t.action,t.exitcode,t.uid, ". DBQueryFatal("select t.exptidx,s.pid,s.eid,t.action,t.exitcode,t.uid, ".
" r.pnodes,t.idx as statno,t.start_time,t.end_time, ". " r.pnodes,t.idx as statno,t.start_time,t.end_time, ".
" s.archive_idx,r.archive_tag,t.uid_idx ". " s.archive_idx,r.archive_tag,t.uid_idx ".
" from testbed_stats as t ". " from testbed_stats as t force index (end_time, idx) ".
"left join experiment_stats as s on s.exptidx=t.exptidx ". "left join experiment_stats as s on s.exptidx=t.exptidx ".
"left join experiment_resources as r on r.idx=t.rsrcidx ". "left join experiment_resources as r on r.idx=t.rsrcidx ".
"$wclause ". "$wclause ".
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment