My question is regarding the handling of MySQL index on VARCHAR combined with an int COLUMN when using prefix matching. e.g. if I have such a query:
SELECT * FROM tbl WHERE name LIKE 'query%' ORDER BY weight DESC LIMIT 5
Considering I have one index one name->weight, does that index need to find all apperances of the prefix query
and then ORDER BY, or does he keeps the cross calculation indexed even with the use of prefix matching (%). I'm troubled by it, because for popular names (e.g. query=john) I might find myself searching for a long time for all appearances of john, and that will make the limit useless and the query to become slow as I'm dealing with a large dataset.