I have a table with about 200.000 entries. Among other things, it
contains an integer field I use as a timestamp, and a variable
character field I use for user names. Certain queries are taking too
long IMO. I'm trying this on both 7.4 and 8.0.
If I do a direct comparison (using =) on the user name field and I
sort by the numeric field, I get about 5 ms. If I do a LIKE on the
user name and I don't sort at all, I get about 5 ms too. But if I use
both LIKE on the user name and sorting on the timestamp, the time
jumps to 2000 ms.
I have indexes on both fields, but I remember reading only one of them
will be used when doing a query.
Is such a serious jump in query times normal or am I doing something wrong?
I'm attaching the explain output for all 3 cases.