My users will upload large csv files. I need to add bulk mysql values (say insert into my_table (name, email) values ('john', 'abc@d.co'), ('foo','def@g.org') ...
)
If duplicate emails exist on the database or in the query itself, they shouldn't be inserted (or they should be updated with the new name).
I was running a single query check per value but performance was awful (a 2,000 csv file was taking up to a minute, or more).
How can I optimize this, preferably a great query, or creating a unique composite key (user_id and email combination is unique) and stating insert ignore into my_table ...
to ignore duplicates. But how?
Thanks!