Table User has around 34k records.
I am firing this query-
SELECT user_pid, user_fname, user_lname, user_uname, user_mobno, user_email, user_date,
user_userid, user_type, user_status
FROM User
WHERE ((lower(user_fname) like'%all%'
OR lower(user_fname) like'%that%')
OR (lower(user_lname) like'%all%'
OR lower(user_fname) like'%that%'))
AND user_status!=3
AND user_type != 1
LIMIT 20;
Explain result is-
+----+-------------+---------+-------+---------------+-------+---------+------+-------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+-------+---------------+-------+---------+------+-------+-------------+
| 1 | SIMPLE | User | range | users | users | 4 | NULL | 16967 | Using where |
+----+-------------+---------+-------+---------------+-------+---------+------+-------+-------------+
Index on table-
users(user_type, user_status)
Where should I add indexes to make this query fast ?