I know there are a bunch of questions like this, but some don't work with MySQL and others seem to run infinitely until I kill them manually using the processlist
, including the one below.
-- both tables have around 3.5 million rows
UPDATE A a
INNER JOIN B b ON a.indexed = b.indexed
SET a.B_id = b.id;
I guess where I deviated from the other questions is that I don't join on the primary keys (I'm updating those instead), but I don't think that should matter. And around 3.5 million rows (both tables) shouldn't spill over to disk unless perhaps I'm accidentally running a Cartesian product.
So what am I doing wrong?
/edit: query finally finished on the server after about 40 minutes.