I am querying a database with a follwing query. This request takes 21 seconds. I check it by explaining the request. I have an index by fields groupId, batchIdseparately.
EXPLAIN SELECT message, sentOn, maskId, isDndCheck, contentType
FROM sms_histories
WHERE groupId = 1750
GROUP BY batchId
ORDER BY batchId DESC
LIMIT 0 , 1
I get the last group message for this request.
My request for an explanation shows me the result
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE sms_histories index groupId batchId 5 NULL 888 Using where
please tell me what is the problem, why does this request take a long time?
source
share