[MDEV-20878] DELETE with auto commit Created: 2019-10-23 Updated: 2022-04-13 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Delete |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Michael Widenius | Assignee: | Sergei Golubchik |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | delete, replication | ||
| Description |
|
DELETE from very_big_table where "delete million rows"
The delete will not affect the master much as it will be run in parallel with other queries. This is a common problem when deleting old rows from tables as part of data cleanups. The suggested solution is to allow deletes to do auto commit for parts of the delete: DELETE from very_big_table where ... AUTO COMMIT EVERY 1000 ROWS This will allow the salve to run the delete in parallel as the master. The disadvantage is that if the statement fails in the middle, then what is already commit will continue to be deleted. From the user point of view this should work as an optimized version if: repeat as long as some rows where deleted The new solution is superior to above pseudo code as we don't have to start searching for rows to delete from the start of the table for each delete block. Things to do in the server:
|