The SELECT event_time AS checkInTime FROM bt_agent_event
WHERE
Agent_id='300300'
AND create_time & gt; '2018-02-23'
AND ` status `=1
AND skill_id IS NOT NULL
The ORDER BY
Event_time
LIMIT 1;
Database data about 10 million or so, with the index, query slowly reached 400 seconds, but if you remove limit 1 or order by or the where, when the query is very fast, is zero seconds,





To solve!
CodePudding user response:
Remove the limit in which indexWith this index