aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-02-14 18:30:24 +0100
committerLudovic Courtès <ludo@gnu.org>2018-02-14 20:14:28 +0100
commitdb27955ad3fae260ee2aa4bace8dd6a4115d338c (patch)
treef113f22eb31dde9b9af14dd775e501e986e04f30
parentb71f0cdca5aeb82e5eb24f54b32e3f09fee22bad (diff)
downloadcuirass-db27955ad3fae260ee2aa4bace8dd6a4115d338c.tar
cuirass-db27955ad3fae260ee2aa4bace8dd6a4115d338c.tar.gz
sql: Add indices to speed up common queries.
* src/schema.sql: Add indices.
-rw-r--r--src/schema.sql6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/schema.sql b/src/schema.sql
index 0ee428c..8d3a651 100644
--- a/src/schema.sql
+++ b/src/schema.sql
@@ -60,4 +60,10 @@ CREATE TABLE Builds (
FOREIGN KEY (evaluation) REFERENCES Evaluations (id)
);
+-- Create indexes to speed up common queries, in particular those
+-- corresponding to /api/latestbuilds HTTP requests.
+CREATE INDEX Builds_Derivations_index ON Builds(status ASC, derivation, evaluation, stoptime DESC);
+CREATE INDEX Specifications_index ON Specifications(repo_name, branch);
+CREATE INDEX Derivations_index ON Derivations(derivation, evaluation, job_name, system);
+
COMMIT;