Page MenuHomePhabricator

"phabricator_repository.repository_commit" table has poor keys for naive iteration
Closed, ResolvedPublic

Description

See PHI1540. In at least two workflows (bin/repository rebuild-identities and bin/audit delete) we iterate over all commits in a repository.

This currently resolves into a ... WHERE repositoryID = X id < Y ORDER BY id DESC query, but there is no <repositoryID, id> key on the table, and we can end up with a less-than-ideal query. There are two nearly-suitable keys (<repositoryID, epoch, [id]> and <repositoryID, importStatus, [id]>).

Both workflows can likely be made better by adding an additional epoch ordering to the query, so the full <repositoryID, epoch, [id]> key can be used.

Revisions and Commits

Restricted Differential Revision

Event Timeline

epriestley created this task.
epriestley added a revision: Restricted Differential Revision.Nov 19 2019, 6:10 PM
epriestley closed this task as Resolved by committing Restricted Diffusion Commit.Nov 19 2019, 6:19 PM
epriestley added a commit: Restricted Diffusion Commit.