Mysql batch delete lock table solution?

some table in mysql, constantly inserting new data. But to prevent it from getting bigger, you need to execute the delete from statement at the same time to delete the old data before a certain point in time.

now the problem is, when deleting, do not dare to delete too many pieces of data, otherwise, the more you delete, the longer the table will be locked.
can only be deleted more than 100 entries. However, this speed is much less than the number of inserts.

ask, is there any way to make the same table of mysql allow both delete and insert, and keep the total at a certain level of balance. It is mainly the problem of delete locking the table.

Feb.23,2022

you can delete each entry in the program or by using the function/ stored procedure, and the total number of entries will remain the same

.
  

do you have a good solution?

Menu