As an example, consider what happens when a single table row is updated in an implicit transaction. Imagine a simple heap table with an integer column c1 and a char column c2. The table has 10,000 rows, and a user submits an update query as follows:
UPDATE SimpleTable SET c1 = 10 WHERE c2 LIKE '%Paul%';
The following operations take place:
The data pages from SimpleTable are read from disk into memory (the buffer pool) so they can be searched for matching rows. It turns out that three data pages hold five rows that match the WHERE clause predicate.
The Storage Engine automatically starts an implicit transaction.
The three data pages and five data rows are locked to allow the updates to occur.
The changes are made to the five data records on the three data pages in memory.
The changes are also recorded in log records in the transaction log on disk.
The Storage Engine automatically commits the implicit transaction.
Partager