When an SQL DELETE query expires, what happens to the data?

If I had to run DELETE FROM some_table, and what was the wait time, what happens to the data?

As I see it, one of two things can happen:

  • Data is deleted until the request expires, so if there were 1,000,000 records in the database and the first 500,000 were deleted, they would have been deleted. The database now contains half as much as before the query was completed.

  • The data is deleted, the request time ends, the data is rolled back (I would assume from the logs made DELETE?). The database now contains the same data that it started with.

Both seem logical. Will this happen in 100% of cases? Or does it depend on some settings that I don’t know about? Note that I am not asking about viability DELETE; I understand that it TRUNCATEwill probably be appropriate. This is purely out of curiosity, as a function of timeout s DELETE.

+4
source share
1 answer

Databases Oracle, SQL Server, MySQL, PostgreSQL follow the ACID properties. Therefore, whenever an operator shows a wait time, it should be rolled back. You can get an overview of ACID from this link . delete

+1
source

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


All Articles