Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Need Minimally Logged Operation to Cause Checkpoint!


Need Minimally Logged Operation to Cause Checkpoint!

Author
Message
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47241 Visits: 44377
ScottPletcher (4/5/2013)
GilaMonster (4/5/2013)
Any data modification that is minimally logged has to be written to the data file before the transaction completes



I don't think that's true. If it is, it violates the write-ahead-logging model, which SQL Server uses; only log records should have to be hardened for a transaction to complete, not data blocks.


It does not violate write-ahead logging. Write-ahead logging requires that the log records are written to disk before the data pages that they represent, it does not say anything about the timing between the data pages being written and the end of the transaction. In both minimally and fully logged operations, the log records are hardened on disk before the data pages are written back to the data file.

The difference in terms of writing is that in a fully logged operation, the data changes can be written at any point after the log records, before or after the transaction is committed, because the log records fully describe the changes and hence the change can be redone from just the log records.
In a minimally logged operation, the data changes are written to disk after the log records and before the transaction is considered committed because the log records do not fully describe the change, there's only enough logging for undo operations (the very definition of minimally logged) and hence redo is not possible. As such, the changes must be hardened to disk before the commit is complete to ensure durability.

You can see why if you consider the potential scenario of a crash the millisecond after a bulk operation has committed. If the data changes were not required to be written to disk prior to the commit of the transaction then such a crash could leave a minimally logged operation with the log records describing the change hardened in the log file but the changes data pages not on disk. Since the definition of minimally logged is 'enough logging for undo, not for redo', in such a case SQL would not be able to replay that bulk operation as part of crash recovery and would be required to mark that database as suspect (inconsistent). This obviously is not an acceptable option.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search