The information in this article applies to:
SUMMARYMicrosoft SQL Server version 6.0 can process an UPDATE statement using one of four possible methods. These methods are: deferred, full delete/insert, on-page delete/insert, and in-place. This article discusses the rules that determine which method is used. MORE INFORMATION
The decision concerning deferred update is made at compile time; the
decision concerning the three non-deferred methods is made at execution
time on a row-by-row basis. Since Showplan is based on compile-time
information and not run-time, the update mode it reports may be different
from how the query was actually executed at runtime. You should note that
if the showplan output indicates DEFERRED, the actual query plan used will
always be deferred. To see exactly how the query was processed for non-
deferred udpates, you can use trace flag 323. This is slightly different
from other trace flags; it will only display output to the errorlog, not to
the local session, and it will only write to the errorlog if SQL Server is
started from the command line (for example, sqlservr -c -
dc:\c:\sql60\data\master.dat). (NOTE: This will likely change in post-
version 6.0 builds of SQL Server; it should follow the normal method of
trace output using 3604/3605.)
DEFERREDWhen multiple rows can qualify for the update, if the row can increase in size or if indexed columns are updated the rows could move out ahead of the current position and be processed again (the "Halloween problem"). For example:
In this case, deferred mode must be used. If only a single row can qualify, the Halloween problem cannot occur and deferred update is not required. IN-PLACEWhen an update is done in-place, a log record of type MODIFY is recorded in the log. This record does not contain the old and new values of the row (only the differences), and it cannot handle changes in row length. For in-place updates, the following restrictions apply:
ON-PAGE DELETE/INSERTOn-page delete/insert is an option when one of the above requirements for in-place update is not met. It is more efficient than a full delete/insert because the same row slot is used and only those nonclustered indexes that are actually updated are "fixed-up." If the new row is not the same size as the old row, but there is still enough room on that page for the new row, then on-page delete/insert is used.FULL DELETE/INSERTIn full delete/insert, full delete and insert log records are recorded for the row being updated. In addition, all nonclustered index keys are deleted and re-inserted, regardless of whether or not they were updated. Full delete/insert is used when on-page delete/insert cannot be used, either when there is not enough room on the page for the new row, or when a clustered index key is updated.Additional query words: sql6 update options
Keywords : kbprg kbusage SSrvTran_SQL |
Last Reviewed: April 16, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |