Page MenuHomePhabricator

When building audit queries, prefilter possible "authorPHID" values
ClosedPublic

Authored by epriestley on Feb 7 2019, 7:54 PM.
Tags
None
Referenced Files
F15469172: D20129.id48064.diff
Fri, Apr 4, 10:23 AM
F15439207: D20129.id48064.diff
Wed, Mar 26, 6:21 AM
F15436415: D20129.id.diff
Tue, Mar 25, 1:59 PM
F15430683: D20129.diff
Mon, Mar 24, 8:33 AM
F15425871: D20129.diff
Sun, Mar 23, 6:30 AM
F15389376: D20129.id.diff
Sat, Mar 15, 5:10 AM
F15385081: D20129.id48049.diff
Fri, Mar 14, 9:39 PM
Unknown Object (File)
Feb 18 2025, 6:08 PM
Subscribers
None

Details

Summary

Ref T13244. See PHI1057. Currently, if you're a member of a lot of projects/packages, you can end up with a very large commit.authorPHID IN (...) clause in part of the "Active Audits" query, since your alice token in "Responsible Users: alice" expands into every package and project you can audit on behalf of.

It's impossible for a commit to be authored by anything but a user, and evidence in PHI1057 suggests this giant IN (...) list can prevent MySQL from making effective utilization of the <authorPHID, auditStatus, ...> key on the table.

Prefilter the list of PHIDs to only PHIDs which can possibly author a commit.

(We'll also eventually need to convert the authorPHIDs into identityPHIDs anyway, for T12164, and this moves us slightly toward that.)

Test Plan

Loaded "Active Audits" before and after change, saw a more streamlined and sensible authorPHID IN (...) clause afterwards.

Diff Detail

Repository
rP Phabricator
Branch
audit4
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 21886
Build 29881: Run Core Tests
Build 29880: arc lint + arc unit

Event Timeline

It's also possible we could benefit from doing this in Differential, which builds a similar query, but I'll wait until we confirm that this was a good idea first.

This revision is now accepted and ready to land.Feb 7 2019, 11:24 PM
This revision was automatically updated to reflect the committed changes.