mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Optimize feed query
Summary: This was killing us. `EXPLAIN` after: <table> <tr><th>id</th><th>select_type</th><th>table</th><th>type</th><th>possible_keys</th><th>key</th><th>key_len</th><th>ref</th><th>rows</th><th>Extra</th></tr> <tr><td>1</td><td>SIMPLE</td><td>story</td><td>index</td><td>chronologicalKey</td><td>chronologicalKey</td><td>8</td><td></td><td>201</td><td> </td></tr> <tr><td>1</td><td>SIMPLE</td><td>ref</td><td>ref</td><td>chronologicalKey</td><td>chronologicalKey</td><td>8</td><td>phabricator_feed.story.chronologicalKey</td><td>1</td><td>Using index</td></tr> </table> Test Plan: /feed/ Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3628
This commit is contained in:
parent
5578ccdff2
commit
511a8bae34
2 changed files with 7 additions and 2 deletions
|
@ -139,6 +139,7 @@ final class PhabricatorDirectoryMainController
|
|||
|
||||
$filter = $subnav->selectFilter($this->subfilter, 'all');
|
||||
|
||||
$view = null;
|
||||
switch ($filter) {
|
||||
case 'all':
|
||||
$view = $this->buildFeedView(array());
|
||||
|
|
|
@ -76,11 +76,15 @@ final class PhabricatorFeedQuery
|
|||
private function buildGroupClause(AphrontDatabaseConnection $conn_r) {
|
||||
return qsprintf(
|
||||
$conn_r,
|
||||
'GROUP BY ref.chronologicalKey');
|
||||
'GROUP BY '.($this->filterPHIDs
|
||||
? 'ref.chronologicalKey'
|
||||
: 'story.chronologicalKey'));
|
||||
}
|
||||
|
||||
protected function getPagingColumn() {
|
||||
return 'ref.chronologicalKey';
|
||||
return ($this->filterPHIDs
|
||||
? 'ref.chronologicalKey'
|
||||
: 'story.chronologicalKey');
|
||||
}
|
||||
|
||||
protected function getPagingValue($item) {
|
||||
|
|
Loading…
Reference in a new issue