Page MenuHomePhabricator

Add an index on rc_this_oldid
Closed, DuplicatePublic

Description

For some reason we don't have an index on this field even though a few things want to join on it.

  • ApiQueryContributions hacks around this by joining on rev_user_text = rc_user_text AND rev_timestamp = rc_user_timestamp AND rc_this_oldid = rev_id instead of just rc_this_oldid = rev_id (see T19215 and 3a259992f).
  • DifferenceEngine does a similar hack, selecting rc_timestamp in addition to rc_this_oldid (213c894).
  • And RevDelRevisionItem too (added several refactors earlier in e8e7540)
  • T92018: Provide a way to query if a given revision was patrolled or not is currently blocked on lacking the index, because I didn't think of that hack.

Apparently we used to have a more complicated index on (rc_this_oldid, rc_last_oldid, rc_patrolled) (added in 4280f45), but it was removed without explanation in 74e1bf3 (although 213c894 implies it was removed because of "indexing bloat").

Should we add this index? Or continue hacking around it by using rc_timestamp?