I would like to suggest improving the indices on the follow_links
table.
Currently, the indices on the table are:
'primary key' => array('lid'),
'unique keys' => array(
'uid_name' => array('uid', 'name'),
),
With the current indices, mysql has to do a filesort:
mysql> explain SELECT * FROM follow_links WHERE uid = 0 ORDER BY weight ASC;
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
| 1 | SIMPLE | follow_links | NULL | ref | uid_name | uid_name | 4 | const | 10 | 100.00 | Using index condition; Using filesort |
The select query on follow_links table can be optimized by adding a new index.
mysql> ALTER TABLE `follow_links` ADD INDEX `uid_weight` (`uid`, `weight`);
mysql> explain SELECT * FROM follow_links WHERE uid = 0 ORDER BY weight ASC;
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
| 1 | SIMPLE | follow_links | NULL | ref | uid_name,uid_weight | uid_weight | 4 | const | 10 | 100.00 | Using index condition |
Closed: outdated
2.0
Code
It affects performance. It is often combined with the Needs profiling tag.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.