CodeIgniter Forums
Should I update or delete and Insert? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Should I update or delete and Insert? (/showthread.php?tid=81726)



Should I update or delete and Insert? - lazyme114 - 04-18-2022

I have a function where I have to process large amount of data, and some data may be repeated which needs to be updated. So I am looping through the data and updating if exists and if not inserting into the database. But the problem is that this is making my function running slower. So should I delete previous data and batch insert new data. Or should I continue to update existing data and inserting new data?


RE: Should I update or delete and Insert? - iRedds - 04-18-2022

SQL: insert ... on duplicate key update ?