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
F14058616: D14962.id36154.diff
Sun, Nov 17, 1:21 PM
F14058602: D14962.id36147.diff
Sun, Nov 17, 1:16 PM
F14058589: D14962.id.diff
Sun, Nov 17, 1:12 PM
F14058558: D14962.diff
Sun, Nov 17, 1:00 PM
F14042686: D14962.diff
Tue, Nov 12, 5:20 AM
F14039918: D14962.id36154.diff
Mon, Nov 11, 6:43 AM
F14038215: D14962.id36154.diff
Sun, Nov 10, 10:11 PM
F14018195: D14962.id36154.diff
Tue, Nov 5, 5:55 AM
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.