The expression a.appid LIKE b.logonid
cannot be optimized, not even with a case-insensitive index on appid
.
Therefore, the database has to check every record in userlist
against every record in employeeinfo
, so there are 7K × 30K = 210M comparisons.
You should ensure that the strings in these table have a canonical capitalization so that you can use a plain =
comparison.
Alternatively, create an additional column where you store a lower-case version of the string.