1, consider creating indexes on where and order by columns

2. Avoid using where clauses! = or <> otherwise the engine will abandon the index for a full table scan

3. Avoid null values for fields in the WHERE clause, which will cause the engine to abandon the index and perform a full table scan

select id from t where num is null
Copy the code