This is more of a theory question.
If I'm running 50,000 queries that insert new rows, and 50,000 queries that updates those rows, which one will take less time?
INSERT is faster than UPDATE because UPDATE does what INSERT does and before that it finds the record(s) and marks them deletion. I have a database with 500,000 records.
Insert is more faster than update because in insert there's no checking of data.
Is insert same as update in MySQL? Insert is for adding data to the table, update is for updating data that is already in the table.
We conducted performance testing, and seems select into is slightly faster.
Insert would be faster because with update you need to first search for the record that you are going to update and then perform the update.
Though this hardly seems like a valid comparison as you never have a choice whether to insert or update as the two fill two completely different needs.
EDIT: I should add too that this is with the assumption that there are no insert triggers or other situations that could cause potential bottlenecks.
Insert Operation : Create -> Store
Update Operation : Retrieve -> Modify -> Store
Insert Operation faster.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With