What is the best way to rewrite this query:
SELECT myField
FROM myPrefix.myTable
WHERE myField2 IN (?) AND
GET_LOCK(CONCAT('action:',myField3), 0) = 1
LIMIT 1
myField2
has an index on it.
Right now, MySQL evaluates the IN
operation first (because it knows there is an index on it), and then pipelines the GET_LOCK
operation.
How can I be sure that this will always be the case, and would not switch the other way around across MySQL upgrades/etc.
AKA, my question is, how can I make sure GET_LOCK
is never evaluated first. I would like to keep this all in one query.