From 3a689b4f8b6755adaf170e0d1a27453d197a6225 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sun, 9 Aug 2015 12:43:26 +0000 Subject: reproducible: remote_scheduler: join on the notes table only when needed --- bin/reproducible_remote_scheduler.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py index 2e5f7a9e..59e2498e 100755 --- a/bin/reproducible_remote_scheduler.py +++ b/bin/reproducible_remote_scheduler.py @@ -106,15 +106,16 @@ if arch not in ARCHS: sys.exit(1) if issue or status or built_after or built_before: - formatter = dict(suite=suite) + formatter = dict(suite=suite, notes_table='') log.info('Querying packages with given issues/status...') query = 'SELECT s.name ' + \ - 'FROM sources AS s, notes AS n, results AS r ' + \ - 'WHERE n.package_id=s.id AND r.package_id=s.id ' + \ + 'FROM sources AS s, {notes_table} results AS r ' + \ + 'WHERE r.package_id=s.id ' + \ 'AND s.suite = "{suite}" AND r.status != "blacklisted" ' if issue: - query += 'AND n.issues LIKE "%{issue}%" ' + query += 'AND n.package_id=s.id AND n.issues LIKE "%{issue}%" ' formatter['issue'] = issue + formatter['notes_table'] = 'notes AS n,' if status: query += 'AND r.status = "{status}"' formatter['status'] = status -- cgit v1.2.3-70-g09d2