mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +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');
|
$filter = $subnav->selectFilter($this->subfilter, 'all');
|
||||||
|
|
||||||
|
$view = null;
|
||||||
switch ($filter) {
|
switch ($filter) {
|
||||||
case 'all':
|
case 'all':
|
||||||
$view = $this->buildFeedView(array());
|
$view = $this->buildFeedView(array());
|
||||||
|
|
|
@ -76,11 +76,15 @@ final class PhabricatorFeedQuery
|
||||||
private function buildGroupClause(AphrontDatabaseConnection $conn_r) {
|
private function buildGroupClause(AphrontDatabaseConnection $conn_r) {
|
||||||
return qsprintf(
|
return qsprintf(
|
||||||
$conn_r,
|
$conn_r,
|
||||||
'GROUP BY ref.chronologicalKey');
|
'GROUP BY '.($this->filterPHIDs
|
||||||
|
? 'ref.chronologicalKey'
|
||||||
|
: 'story.chronologicalKey'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getPagingColumn() {
|
protected function getPagingColumn() {
|
||||||
return 'ref.chronologicalKey';
|
return ($this->filterPHIDs
|
||||||
|
? 'ref.chronologicalKey'
|
||||||
|
: 'story.chronologicalKey');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getPagingValue($item) {
|
protected function getPagingValue($item) {
|
||||||
|
|
Loading…
Reference in a new issue