branch: master
commit 238f856e48ee333ed3e19fa32ce5e1742c650c67
Author: Ludovic Courtès <l...@gnu.org>
Date:   Tue Apr 10 17:21:06 2018 +0200

    database: Adjust index to speed up /api/queue queries.
    
    * src/schema.sql: Extend 'Builds_Derivations_index' to account for
    /api/queue queries.
---
 src/schema.sql | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/schema.sql b/src/schema.sql
index 8d3a651..65aebbd 100644
--- a/src/schema.sql
+++ b/src/schema.sql
@@ -61,8 +61,8 @@ CREATE TABLE Builds (
 );
 
 -- 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);
+-- corresponding to /api/latestbuilds and /api/queue HTTP requests.
+CREATE INDEX Builds_Derivations_index ON Builds(status ASC, timestamp ASC, id, 
derivation, evaluation, stoptime DESC);
 CREATE INDEX Specifications_index ON Specifications(repo_name, branch);
 CREATE INDEX Derivations_index ON Derivations(derivation, evaluation, 
job_name, system);
 

Reply via email to