Bug 1062469
Summary: | Add missing index for command_queue.status field | ||
---|---|---|---|
Product: | [Retired] Beaker | Reporter: | Nick Coghlan <ncoghlan> |
Component: | general | Assignee: | Dan Callaghan <dcallagh> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | tools-bugs <tools-bugs> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 0.15 | CC: | aigao, asaha, dcallagh, llim, qwan, rmancy, xjia |
Target Milestone: | 0.16 | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2014-03-17 03:01:56 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Nick Coghlan
2014-02-07 01:04:44 UTC
Specifically we should examine the following query from mysqld slow query log, which appears to be from labcontroller.get_queued_commands: SELECT command_queue.status AS command_queue_status, [...] FROM activity INNER JOIN command_queue ON activity.id = command_queue.id INNER JOIN system ON system.id = command_queue.system_id WHERE 8 = system.lab_controller_id AND command_queue.status = 'Queued' ORDER BY activity.id; to verify that it is indeed picking an expensive query plan (check EXPLAIN) and that adding the index fixes it (check EXPLAIN again after adding the index). (In reply to Dan Callaghan from comment #1) Adding the index on command_queue.status reduces the time for this query from 29 seconds down to 0.01 seconds in my testing. EXPLAIN before: +----+-------------+---------------+--------+---------------------------+-------------------+---------+----------------------------------+------+-----------------------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+---------------+--------+---------------------------+-------------------+---------+----------------------------------+------+-----------------------------------------------------------+ | 1 | SIMPLE | system | ref | PRIMARY,lab_controller_id | lab_controller_id | 5 | const | 2225 | Using where; Using index; Using temporary; Using filesort | | 1 | SIMPLE | command_queue | ref | PRIMARY,system_id | system_id | 4 | beaker_dcallagh.system.id | 696 | Using where | | 1 | SIMPLE | activity | eq_ref | PRIMARY | PRIMARY | 4 | beaker_dcallagh.command_queue.id | 1 | | +----+-------------+---------------+--------+---------------------------+-------------------+---------+----------------------------------+------+-----------------------------------------------------------+ EXPLAIN after: +----+-------------+---------------+--------+---------------------------+---------+---------+-----------------------------------------+------+----------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+---------------+--------+---------------------------+---------+---------+-----------------------------------------+------+----------------------------------------------+ | 1 | SIMPLE | command_queue | ref | PRIMARY,system_id,status | status | 1 | const | 25 | Using where; Using temporary; Using filesort | | 1 | SIMPLE | system | eq_ref | PRIMARY,lab_controller_id | PRIMARY | 4 | beaker_dcallagh.command_queue.system_id | 1 | Using where | | 1 | SIMPLE | activity | eq_ref | PRIMARY | PRIMARY | 4 | beaker_dcallagh.command_queue.id | 1 | | +----+-------------+---------------+--------+---------------------------+---------+---------+-----------------------------------------+------+----------------------------------------------+ On Gerrit: http://gerrit.beaker-project.org/2834 if no regression bug is found in acceptance test for version 0.16, will move this bug to "VERIFIED" Beaker 0.16.0 has been released. *** Bug 1079094 has been marked as a duplicate of this bug. *** |