For a large table (1 million records) I have an update query like this:
update direct_words set weight = (weight / 4) where knowledge_id = :a
and phrase_id in (select phrase_id from phrases where knowledge_id =:b
and phrase_class <> 6);
I have several indexes, but one is for the fields:
knowledge_id;phrase_id
This runs very fast under SQLite (2 seconds or less), but for MySQL the same query takes about 37 seconds. What am I doing wrong?
try execututing it using
JOIN