6895db39e3ecfc17d06d5e8699325e42a2957b6a |
|
01-May-2013 |
Alex Miller <milleral@chromium.org> |
[autotest] Index status on hqe table. The query to get all Queued HQEs looks like SELECT * FROM afe_host_queue_entries INNER JOIN afe_jobs ON (job_id=afe_jobs.id) WHERE NOT complete AND NOT active AND status="Queued" ORDER BY afe_jobs.priority DESC, meta_host, job_id; This query can have some trouble, since the ORDER BY on columns across tables means that MySQL has to make a temporary table, and then sort the table. However, one can't avoid this just by index creation, so this is left as an unsolved "problem" for now. We currently have all `id` fields and `meta_host` indexed, with `active`, `complete` and `status` being un-indexed. Messing with indexes here showed that an index on `status` was most effective, and dropped the query from 1.53s to 0.07s on a db filled with a backup from prod. BUG=chromium:236636 DEPLOY=migrate TEST=ran migration, ran now-faster query Change-Id: I1c251b7d1fe95da396ce1e4873447d4294f8385a Reviewed-on: https://gerrit.chromium.org/gerrit/49712 Commit-Queue: Alex Miller <milleral@chromium.org> Reviewed-by: Alex Miller <milleral@chromium.org> Tested-by: Alex Miller <milleral@chromium.org>
/external/autotest/frontend/migrations/076_index_pending_hqe.py
|