Page MenuHomePhabricator

UserMerge using SELECT img_name FROM image WHERE img_user = ... but img_user doesn't have an index
Closed, ResolvedPublic

Description

There's an index on img_user_text: CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp);

Should we create an img_user index? Or switch to using img_user_text?

Event Timeline

Legoktm raised the priority of this task from to High.
Legoktm updated the task description. (Show Details)
Legoktm added subscribers: Legoktm, aaron.

Is there a downside to using img_user_text?

It's nice for consistency for image/oldimage to have user,time indexes (neither do), but I'm not sure it's worth it. It would be nice to have the pros/cons.

The only downside I can think of is that it works against T33863: Fix use of DB schema so RenameUser is trivial. We'd also have to add some logic into UserMerge to make it use the _text field for selecting, but that should be trivial.

In what way does it work against it? As long as there are both text/ID user fields, renames can just use the user table. User merges, of course, need to use some index, both those are already not "trivial" anyway for that reason (e.g. O(N) updates).

I would close this as resolved due to Aaron advise is correct in the current situation, and further optimizations can be discussed at T33863 (including creating additional indexes). More than a task with actionable or a bug report, this seems like an RFC, and I do not think there is much else to add unless an "add index X" task is created?

Marostegui subscribed.

Agreed with Jaime. Closing this for now.
It has been a while since this was opened and the image table has gone thru some schema changes already, so might be worth revaulting if this is really needed anymore or not.
Thanks everyone!