Azaly
Active member
Hi! I got sql performance issue after updating XenForo 2.2.3 (not sure is it matter, but in same time I created custom thread field for the first time and deleting 10 popular tags). Now my slow query log is full of queries like this:
Explain:
ANALYZE TABLE:
This happens when moderators merge 2 post in large threads (10–20K messages). There are no issue with posting or deleting posts in these threads and everything is ok with merging posts inside small threads.
I’ve struggling with this almost a week and do not find a clue. My server admin couldn't find any problem in config too.
(After updating XenForo 2.2.3 I got also long queries like here and
I use nginx 1.9.3, php 7.2.23, mariadb 10.5.6 + memcached
Thanks
Code:
SELECT post_id, post_date, user_id, username, reaction_score, reactions FROM xf_post WHERE thread_id = '14369' ORDER BY post_date LIMIT 1;
+---------+------------+---------+----------+----------------+----------------+
| post_id | post_date | user_id | username | reaction_score | reactions |
+---------+------------+---------+----------+----------------+----------------+
| 4193961 | 1606840932 | 111 | Li | 25 | {"1":24,"4":1} |
+---------+------------+---------+----------+----------------+----------------+
1 row in set (22.006 sec)
Explain:
Code:
explain SELECT post_id, post_date, user_id, username, reaction_score, reactions FROM xf_post WHERE thread_id = '14369' ORDER BY post_date LIMIT 1;
+------+-------------+---------+-------+-------------------------------------------------------------+-----------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+---------+-------+-------------------------------------------------------------+-----------+---------+------+------+-------------+
| 1 | SIMPLE | xf_post | index | thread_id_post_date,thread_id_position,thread_id_score_date | post_date | 4 | NULL | 196 | Using where |
+------+-------------+---------+-------+-------------------------------------------------------------+-----------+---------+------+------+-------------+
1 row in set (0.001 sec)
ANALYZE TABLE:
Code:
ANALYZE TABLE xf_post;
+--------------------+---------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+--------------------+---------+----------+----------+
| xf_post | analyze | status | OK |
+--------------------+---------+----------+----------+
1 row in set (0.042 sec)
ANALYZE TABLE xf_reaction_content;
+--------------------------------+---------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+--------------------------------+---------+----------+----------+
| xf_reaction_content | analyze | status | OK |
+--------------------------------+---------+----------+----------+
1 row in set (0.079 sec)
This happens when moderators merge 2 post in large threads (10–20K messages). There are no issue with posting or deleting posts in these threads and everything is ok with merging posts inside small threads.
I’ve struggling with this almost a week and do not find a clue. My server admin couldn't find any problem in config too.
(After updating XenForo 2.2.3 I got also long queries like here and
set optimizer_use_condition_selectivity=1
as @Xon suggested there, but problem with merging still there.)I use nginx 1.9.3, php 7.2.23, mariadb 10.5.6 + memcached
Thanks