An older item which was lost during a servercrash:
When using replace is can become rather ineffective if you have large tables (really large ;)) with indexes. While REPLACE INTO looks like it either performs an update or an insert it will execute in both cases an insert. If the row exists it will first delete the row and after the delete it will insert the ‘new’ row. If you have a large table with rather large indexes both the insert as the delete wil have an impact on the rebuild of your index. Using a simple select to check if the row exists and if so perform an update is with large tables far more effectient and is worth benchmarking on small tables


Discussion
View Comments for “MySQLs replace into sometimes a big nono”