mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-13 02:12:41 +01:00
Add a missing table key to improve performance of "Recently Completed Tasks" query
Summary: Fixes T11490. Currently, this query can not use a key and the table size may be quite large. Adjust the query so it can use a key for both selection and ordering, and add that key. Test Plan: Ran `EXPLAIN` on the old query in production, then added the key and ran `EXPLAIN` on the new query. Saw key in use, and "rows" examined drop from 29,273 to 15. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11490 Differential Revision: https://secure.phabricator.com/D16423
This commit is contained in:
parent
4d175ac709
commit
3bd0da0ec2
2 changed files with 5 additions and 0 deletions
|
@ -104,6 +104,8 @@ final class PhabricatorWorkerArchiveTaskQuery
|
||||||
|
|
||||||
if ($this->dateCreatedBefore) {
|
if ($this->dateCreatedBefore) {
|
||||||
return qsprintf($conn_r, 'ORDER BY dateCreated DESC, id DESC');
|
return qsprintf($conn_r, 'ORDER BY dateCreated DESC, id DESC');
|
||||||
|
} else if ($this->dateModifiedSince) {
|
||||||
|
return qsprintf($conn_r, 'ORDER BY dateModified DESC, id DESC');
|
||||||
} else {
|
} else {
|
||||||
return qsprintf($conn_r, 'ORDER BY id DESC');
|
return qsprintf($conn_r, 'ORDER BY id DESC');
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@ final class PhabricatorWorkerArchiveTask extends PhabricatorWorkerTask {
|
||||||
'leaseOwner' => array(
|
'leaseOwner' => array(
|
||||||
'columns' => array('leaseOwner', 'priority', 'id'),
|
'columns' => array('leaseOwner', 'priority', 'id'),
|
||||||
),
|
),
|
||||||
|
'key_modified' => array(
|
||||||
|
'columns' => array('dateModified'),
|
||||||
|
),
|
||||||
) + $parent[self::CONFIG_KEY_SCHEMA];
|
) + $parent[self::CONFIG_KEY_SCHEMA];
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
|
|
Loading…
Reference in a new issue