One of the top slow queries (P5295):
SELECT /* ChangeTags::tagUsageStatistics */ ct_tag, count(*) AS `hitcount` FROM `change_tag` GROUP BY ct_tag ORDER BY hitcount DESC
Looking at some rows in the table:
MariaDB [wikidatawiki_p]> select * from change_tag LIMIT 20; +-----------+-----------+-----------+---------------+-----------+ | ct_rc_id | ct_log_id | ct_rev_id | ct_tag | ct_params | +-----------+-----------+-----------+---------------+-----------+ | 180404170 | NULL | 179938677 | OAuth CID: 93 | NULL | | 180404172 | NULL | 179938679 | HHVM | NULL | | 180404173 | NULL | 179938680 | HHVM | NULL | | 180404174 | NULL | 179938681 | HHVM | NULL | | 180404175 | NULL | 179938682 | HHVM | NULL | | 180404175 | NULL | 179938682 | OAuth CID: 93 | NULL | | 180404176 | NULL | 179938683 | HHVM | NULL | | 180404177 | NULL | 179938684 | HHVM | NULL | | 180404178 | NULL | 179938685 | HHVM | NULL | | 180404179 | NULL | 179938686 | HHVM | NULL | | 180404180 | NULL | 179938687 | HHVM | NULL | | 180404180 | NULL | 179938687 | OAuth CID: 93 | NULL | | 180404181 | NULL | 179938688 | HHVM | NULL | | 180404182 | NULL | 179938689 | HHVM | NULL | | 180404183 | NULL | 179938690 | HHVM | NULL | | 180404184 | NULL | 179938691 | HHVM | NULL | | 180404184 | NULL | 179938691 | OAuth CID: 93 | NULL | | 180404185 | NULL | 179938692 | HHVM | NULL | | 180404186 | NULL | 179938693 | HHVM | NULL | | 180404187 | NULL | 179938694 | HHVM | NULL | +-----------+-----------+-----------+---------------+-----------+ 20 rows in set (0.00 sec)
The ct_tag column is horrible in so many ways.
- It uses varchar instead of being a foreign key to another table or at least it's not a hash for faster lookup
- By being varchar, name of a ct_tag can not be changed easily (you might need to write tons of rows in order to do that)
- Getting statistics of hitcounts is impossible on big tables.
I suggest ct_tag gets moved to another table and only a foreign key stays here.