Thursday, June 18, 2015

Write Ahead Logging ( Basic)

Write Ahead Logging?? Whats this 

So in SQL server the transaction log concept is to ensure in case you accidently loose the data or data get corrupt we can still recover the same. In Order to achieve this the Transaction logs are maintained . Every time we make changes to data in the database the entry is first made into transaction log.
Here comes the Write ahead logging concept.

Lets suppose there is a addition of new record in some table A.

This information is written to transaction log file first and then the pages from the data file on which the actual new row has to be written is loaded in the memory. Exactly if we say the page is loaded into Write Buffer of the Buffer Pool.

After its loaded the Page is written with the new record and then its marked as dirty page.

Now whenever the checkpoint happens the Page is written back to the disk.


No comments:

Post a Comment