2024-07-11
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
It has been two months since I updated my blog. I was busy with my graduation project and graduation! These two months have been very exciting. I have fully experienced the difference between the workplace and the campus. As a person who has just graduated and has one year of work experience, I have experienced two job transfers and two salary cuts in two months. If there is another layoff, it will be even more exciting! ! Haha
Without further ado, let’s serve the food
Today we will mainly study the relationship between DDL, DML and undo? A few days ago, a colleague in the department asked:
The general meaning is: when executing an insert statement, can it be understood that the undo table space it occupies is the same size as the data file occupied by the table? This is my answer:
Xiao Xiao received praise from the department head!
One of the four characteristics of database transactions isAtomicity, specifically Atomicity means that a series of operations on the database must either succeed completely or fail completely. It is impossible for partial success to occur.In fact,AtomicityThe bottom layer is throughundo logachieved.undo logMainly records the logical changes of data, such as aINSERTStatement, corresponding to aDELETEofundo log, for eachUPDATEstatement, corresponding to an oppositeUPDATEofundo log, so that when an error occurs, you can roll back to the data state before the transaction.undo logTooMVCC(Multi-version Concurrency Control) implementation key. The undo space is mainly used to store data snapshots before transactions are committed, making it easier to roll back transactions.In theory, only key information (minimum information) needs to be recorded in the undo file to ensure that the data before the transaction can be rolled back.For an insert statement, undo only needs to record the ROWID of the inserted row to complete the rollback.The delete statement needs to record the previous image of all columns of the deleted row and its ROWID in Undo; The update statement needs to record the previous image of the updated column and the ROWID of the updated row in the Undo statement;
Why is that? Is that right?
Today, let's study why undo(insert)