Skip to content
Snippets Groups Projects
Commit 52e43af4 authored by Vermaat's avatar Vermaat
Browse files

Optimization for batch scheduler.

Getting the next batch queue entry to process was slow with a large database
due to the getFromQueue select query. This query is now replaced by one that
can make use of an index on the BatchQueue table.


git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/branches/refactor-mutalyzer-branch@296 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
parent 362dc830
No related branches found
No related tags found
No related merge requests found
......@@ -1491,12 +1491,19 @@ class Batch(Db) :
@rtype: triple
"""
# To optimize this query, make sure to have two indices on the
# table:
# - UNIQUE KEY (QueueID)
# - KEY (JobID, QueueID)
statement = """
SELECT QueueID, Input, Flags
FROM BatchQueue
WHERE JobID = %s
ORDER BY QueueID
LIMIT 1;
FROM BatchQueue
WHERE QueueID = (
SELECT QueueID
FROM BatchQueue
GROUP BY JobID
HAVING JobID = %s
);
""", jobID
results = self.query(statement)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment