Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Sequence of change commital

Author  Topic 

Jim Beam
Posting Yak Master

137 Posts

Posted - 2011-01-05 : 08:35:11
Hi all,

Am I correct in thinking that changes like Updates/Inserts etc are first done in cache, then to the T/Log, then to disk?

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-01-05 : 09:16:46
Mostly yes.

When a change is made the data pages are changed in cache and the associated log record is written to the log buffer. When the transaction that the change was part of commits, the log buffer is written to disk, to the log file. (This can happen before the commit also). At a later point, when a checkpoint runs or when the lazy writer starts up the modified data page is written to the data file.

The log records are always written before the data pages. That's a hard requirement of the way SQL does IO, called write-ahead logging.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

Jim Beam
Posting Yak Master

137 Posts

Posted - 2011-01-05 : 09:26:34
Cheers Gail, succinctly put!
Go to Top of Page
   

- Advertisement -