mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 21:02:41 +01:00
Faster 'All Revisions and Reviews' Query
Summary: The 'All Revisions and Reviews' Query takes about 2 seconds when I run it from the mysql command-line: SELECT revision.* FROM `differential_revision` revision LEFT JOIN `differential_relationship` relationship ON revision.id = relationship.revisionID AND relationship.relation = 'revw' WHERE revision.authorPHID in ('PHID-USER-a113b9ae4ee9524d0a20') OR relationship.objectPHID in ('PHID-USER-a113b9ae4ee9524d0a20') GROUP BY revision.id ORDER BY dateModified DESC 2419 rows in set (2.05 sec) This takes about 0.1-0.2 seconds. Just dug into this because I guess phabricator is haven't a bunch of mysql timeouts. I don't know what the hell I'm doing; this is just faster Test Plan: Loaded 'All Revisions and Reviews' in sandbox http://phabricator.dev1577.snc6.facebook.com/differential/filter/related/ Made sure it had same results as the version in prod https://phabricator.fb.com/differential/filter/related/ Still slow to generate all that html Reviewed By: epriestley Reviewers: epriestley, aran, tuomaspelkonen, jungejason CC: aran, epriestley Differential Revision: 182
This commit is contained in:
parent
497a2eec6a
commit
2e96565f67
1 changed files with 26 additions and 3 deletions
|
@ -90,10 +90,33 @@ class DifferentialRevisionListData {
|
|||
$this->ids);
|
||||
break;
|
||||
case self::QUERY_OWNED_OR_REVIEWER:
|
||||
$this->revisions = $this->loadAllWhereJoinReview(
|
||||
'revision.authorPHID in (%Ls) OR relationship.objectPHID in (%Ls)',
|
||||
$rev = new DifferentialRevision();
|
||||
$data = queryfx_all(
|
||||
$rev->establishConnection('r'),
|
||||
'SELECT revs.* FROM (
|
||||
(
|
||||
SELECT revision.*
|
||||
FROM %T revision
|
||||
WHERE revision.authorPHID in (%Ls)
|
||||
)
|
||||
UNION
|
||||
(
|
||||
SELECT revision.*
|
||||
FROM %T revision, %T rel
|
||||
WHERE rel.revisionId = revision.Id
|
||||
AND rel.relation = %s
|
||||
AND rel.objectPHID in (%Ls)
|
||||
)
|
||||
) as revs
|
||||
%Q',
|
||||
$rev->getTableName(),
|
||||
$this->ids,
|
||||
$this->ids);
|
||||
$rev->getTableName(),
|
||||
DifferentialRevision::RELATIONSHIP_TABLE,
|
||||
DifferentialRevision::RELATION_REVIEWER,
|
||||
$this->ids,
|
||||
$this->getOrderClause());
|
||||
$this->revisions = $rev->loadAllFromArray($data);
|
||||
break;
|
||||
case self::QUERY_NEED_ACTION_FROM_SELF:
|
||||
$rev = new DifferentialRevision();
|
||||
|
|
Loading…
Reference in a new issue