Very Slow Query

alfa1

Well-Known Member
My host alerted me that this query is causing problems:
Code:
# Thread_id: 2067848  Schema: xxx  QC_hit: No
# Query_time: 2.668364  Lock_time: 0.000146  Rows_sent: 1  Rows_examined: 1
# Rows_affected: 0
SET timestamp=1523569940;
SELECT thread.*
               ,
                   user.gender, user.avatar_date, user.gravatar,
                   NULL AS thread_read_date,
                   0 AS thread_reply_banned,
                   0 AS thread_is_watched,
                   '' AS draft_message, NULL AS draft_extra,team.title as team_title,team.team_id as team_team_id,
               team.user_id as team_user_id, team.team_state as team_team_state, team.privacy_state as team_privacy_state, 27 AS itemtypeid, thread.thread_id AS itemid
           FROM xf_thread AS thread
          
                   LEFT JOIN xf_user AS user ON
                       (user.user_id = thread.user_id)
               LEFT JOIN xf_team AS team ON (team.team_id = thread.team_id)
           WHERE thread.thread_id = '81601';
 
Can you run this query:
Code:
EXPLAIN
SET timestamp=1523569940;
SELECT thread.*
               ,
                   user.gender, user.avatar_date, user.gravatar,
                   NULL AS thread_read_date,
                   0 AS thread_reply_banned,
                   0 AS thread_is_watched,
                   '' AS draft_message, NULL AS draft_extra,team.title as team_title,team.team_id as team_team_id,
               team.user_id as team_user_id, team.team_state as team_team_state, team.privacy_state as team_privacy_state, 27 AS itemtypeid, thread.thread_id AS itemid
           FROM xf_thread AS thread
          
                   LEFT JOIN xf_user AS user ON
                       (user.user_id = thread.user_id)
               LEFT JOIN xf_team AS team ON (team.team_id = thread.team_id)
           WHERE thread.thread_id = '81601';
 
Back
Top