https://bugzilla.wikimedia.org/show_bug.cgi?id=52728

Sean Pringle <sprin...@wikimedia.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sprin...@wikimedia.org

--- Comment #3 from Sean Pringle <sprin...@wikimedia.org> ---
Even the solution without GROUP BY could be slow for very active users. The
index used is probably always revision user_timestamp (rev_user,
rev_timestamp). Since rev_timestamp is in second place MAX() must still do a
range scan on the user's portion of the btree.

As we're already proposing to query separately for each user then pulling the
user data out first in bulk and removing the join in the individual user
queries would be predictable and faster:

SELECT user_id, user_editcount FROM user WHERE user_name in (...);

foreach $user_id:
    SELECT MAX(rev_timestamp) FROM revision WHERE rev_user = $user_id;

*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: NULL
         type: NULL
possible_keys: NULL
          key: NULL
      key_len: NULL
          ref: NULL
         rows: NULL
        Extra: Select tables optimized away
1 row in set (0.29 sec)

Each user needs a single Handler_read_key hit on revision rev_timestamp
(rev_timestamp) index regardless of how many revisions they have authored.

Worth considering.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to