If you have the record already in the table you should update it instead of removing it and recreating it. Update is one transaction while deleting and recreating needs two.
Oct 9, 2021
4
Level 1
UPDATE or INSERT statement better for this case?
I have a simple table to store data just for reading. For example, It consists of id, payload, user_id and timestamps.
I am doing sync every day for this table and just renew the data in payload column.
Is it better to use UPDATE or INSERT statement? If I am using INSERT statement means I need to delete the rows and re-insert again. Which may caused the increment ID grow faster.
From my point of view, UPDATE statement will run perform better right? CMIIW.
Please or to participate in this conversation.