We have a database that gets updated everyday at midnight with a cronjob, we get new data from an external XML.
What we do is that we insert all the new content and
Add an update_count INT NOT NULL DEFAULT 1
column and change your query:
INSERT
INTO table (id, col1, col2, col3)
VALUES
(id_value, val1, val2, val3),
(id_value, val1, val2, val3,),
(id_value, val1, val2, val3),
(id_value, val1, val2, val3),
ON DUPLICATE KEY
UPDATE
col1 = VALUES (col1),
col2 = VALUES (col2),
col3 = VALUES (col3),
update_count = update_count + 1;
You can also increment it in a BEFORE UPDATE
trigger which will allow you to keep the query as is.