[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Ludovic Courtès |
Date: |
Wed, 14 Feb 2018 17:27:22 -0500 (EST) |
branch: master
commit db27955ad3fae260ee2aa4bace8dd6a4115d338c
Author: Ludovic Courtès <address@hidden>
Date: Wed Feb 14 18:30:24 2018 +0100
sql: Add indices to speed up common queries.
* src/schema.sql: Add indices.
---
src/schema.sql | 6 ++++++
1 file changed, 6 insertions(+)
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;