I am working on a large MySQL database and I need to improve INSERT performance on a specific table. This one contains about 200 Millions rows and its structure is as follow
You could use
load data local infile '' REPLACE into table
etc...
The REPLACE ensure that any duplicate value is overwritten with the new values. Add a SET updated_at=now() at the end and you're done.
REPLACE
SET updated_at=now()
There is no need for the temporary table.