Page MenuHomePhabricator

Improve construction of commit queries from blame lookups
ClosedPublic

Authored by epriestley on Jan 6 2016, 11:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 24, 10:25 PM
Unknown Object (File)
Fri, Apr 19, 4:03 PM
Unknown Object (File)
Mar 14 2024, 9:31 PM
Unknown Object (File)
Mar 14 2024, 5:44 PM
Unknown Object (File)
Mar 14 2024, 5:26 PM
Unknown Object (File)
Mar 14 2024, 5:10 PM
Unknown Object (File)
Mar 14 2024, 4:43 PM
Unknown Object (File)
Mar 14 2024, 4:29 PM
Subscribers
None

Details

Summary

Ref T2450. File blame tends to have the same commit a lot of times, and we don't do lookups like this efficiently right now.

In particular, for a file like __phutil_library_map__.php, we would issue a query with ~9,000 clauses like this:

(repositoryID = 1 AND commitIdentifier LIKE "XYZ%")

...but only a few hundred of those identifiers were unique. Instead, issue only one clause per unique identifier.

MySQL also seems to do a little better on "commitIdentifier = X" if we have the full hash, so special case that slightly.

Test Plan
  • Issuing a query for only unique identifiers dropped the cost from 400ms to 100ms locally.
  • Swapping to = if we have the full hash dropped the cost from 100ms to 75ms locally.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Improve construction of commit queries from blame lookups.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Jan 7 2016, 2:23 AM
This revision was automatically updated to reflect the committed changes.