1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 20:10:55 +01:00

Remove ORDER_PATH_MODIFIED from Differential

Summary:
Ref T7803. This is a performance hack, not a real order, and isn't really meaningful or pageable.

After D12158, we constraint his query on `dateModified` anyway, which should generally give the database a relatively small result set to examine.

Test Plan: Browsed Differential and Diffusion. Checked query plan, it didn't look too crazy.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12361
This commit is contained in:
epriestley 2015-04-11 20:16:52 -07:00
parent e0fa0fbdee
commit 9b5198f463
3 changed files with 2 additions and 24 deletions

View file

@ -786,7 +786,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
->setViewer($this->getRequest()->getUser()) ->setViewer($this->getRequest()->getUser())
->withStatus(DifferentialRevisionQuery::STATUS_OPEN) ->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
->withUpdatedEpochBetween($recent, null) ->withUpdatedEpochBetween($recent, null)
->setOrder(DifferentialRevisionQuery::ORDER_PATH_MODIFIED) ->setOrder(DifferentialRevisionQuery::ORDER_MODIFIED)
->setLimit(10) ->setLimit(10)
->needFlags(true) ->needFlags(true)
->needDrafts(true) ->needDrafts(true)

View file

@ -44,14 +44,6 @@ final class DifferentialRevisionQuery
private $order = 'order-modified'; private $order = 'order-modified';
const ORDER_MODIFIED = 'order-modified'; const ORDER_MODIFIED = 'order-modified';
const ORDER_CREATED = 'order-created'; const ORDER_CREATED = 'order-created';
/**
* This is essentially a denormalized copy of the revision modified time that
* should perform better for path queries with a LIMIT. Critically, when you
* browse "/", every revision in that repository for all time will match so
* the query benefits from being able to stop before fully materializing the
* result set.
*/
const ORDER_PATH_MODIFIED = 'order-path-modified';
private $needRelationships = false; private $needRelationships = false;
private $needActiveDiffs = false; private $needActiveDiffs = false;
@ -894,14 +886,6 @@ final class DifferentialRevisionQuery
'type' => 'int', 'type' => 'int',
); );
break; break;
case self::ORDER_PATH_MODIFIED:
$columns[] = array(
'table' => 'p',
'column' => 'epoch',
'value' => $cursor->getDateCreated(),
'type' => 'int',
);
break;
} }
$columns[] = array( $columns[] = array(
@ -932,12 +916,6 @@ final class DifferentialRevisionQuery
return 'id'; return 'id';
} }
return 'r.id'; return 'r.id';
case self::ORDER_PATH_MODIFIED:
if (!$this->pathIDs) {
throw new Exception(
'To use ORDER_PATH_MODIFIED, you must specify withPath().');
}
return 'p.epoch';
default: default:
throw new Exception("Unknown query order constant '{$this->order}'."); throw new Exception("Unknown query order constant '{$this->order}'.");
} }

View file

@ -199,7 +199,7 @@ abstract class DiffusionBrowseController extends DiffusionController {
->withPath($repository->getID(), $path_id) ->withPath($repository->getID(), $path_id)
->withStatus(DifferentialRevisionQuery::STATUS_OPEN) ->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
->withUpdatedEpochBetween($recent, null) ->withUpdatedEpochBetween($recent, null)
->setOrder(DifferentialRevisionQuery::ORDER_PATH_MODIFIED) ->setOrder(DifferentialRevisionQuery::ORDER_MODIFIED)
->setLimit(10) ->setLimit(10)
->needRelationships(true) ->needRelationships(true)
->needFlags(true) ->needFlags(true)