Mysql removal efficiency

I have a table with a lot of data. Data needs to be updated frequently: delete old data and add new data. I have two options

  • whenever there is a delete event, I immediately delete the entry
  • I noted deleting records and using the cron job to delete at off-peak times.

is there any difference in efficiency between the two parameters? or any better solution?

+3
source share
3 answers
  • Both deletions and updates can have triggers, this can affect performance (check if this is appropriate for your case).
  • Updating a row is usually faster than deleting (due to indexes, etc.).

. , , "" "". , , - , .

+1

MySQL , CPU () , MySQL .

, , , DELETE QUICK. InnoDB , , .

, .

In this case, there is no need to implement the functionality of your application, which MySQL will do internally.

0
source

Source: https://habr.com/ru/post/1760390/


All Articles