Reputation: 2869
I'm trying update rows in a table (called "users") based on values found in another table (called "users_temp"). I have the query:
UPDATE users
INNER JOIN users_temp on users_temp.email = users.email
SET users.list_id = users_temp.list_id
Both tables have about 50k rows and this query basically just crashes MySQL.
Can someone suggest a better way of doing this or tell me why MySQL is crashing?
Thanks!
Upvotes: 0
Views: 51
Reputation: 25351
Your query is ok. To boost the performance, try indexing the "email" column in both tables before you run the query.
Without the indexes, it has to scan the entire 50k rows in both tables (so total of 100k rows) to find the matches.
Upvotes: 1