From ca4c0db2c1858c636d26936ae52cdbc666f68263 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 10 Mar 2016 17:33:45 -0800 Subject: [PATCH] Add a key to improve Diffusion's cache fill history query Summary: Ref T10560. I don't fully understand what MySQL is doing here, but it looks like this key improves the problematic dataset in practice. (It makes sense that this key helps, I'm just not sure why the two separate keys and the UNION ALL are so bad.) This key isn't hugely expensive to add, so we can try it and see if there are still issues. Test Plan: Ran `bin/storage adjust`, saw key added to table. Used `SHOW CREATE TABLE ...` to verify the key exists. Used `EXPLAIN SELECT ...` to make sure MySQL actually uses it. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10560 Differential Revision: https://secure.phabricator.com/D15460 --- .../repository/storage/PhabricatorRepositorySchemaSpec.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/applications/repository/storage/PhabricatorRepositorySchemaSpec.php b/src/applications/repository/storage/PhabricatorRepositorySchemaSpec.php index 8ff2ed0c9b..4471151d4e 100644 --- a/src/applications/repository/storage/PhabricatorRepositorySchemaSpec.php +++ b/src/applications/repository/storage/PhabricatorRepositorySchemaSpec.php @@ -155,6 +155,9 @@ final class PhabricatorRepositorySchemaSpec 'repositoryID' => array( 'columns' => array('repositoryID', 'pathID', 'commitSequence'), ), + 'key_history' => array( + 'columns' => array('commitID', 'isDirect', 'changeType'), + ), )); $this->buildRawSchema(