Microsoft KB Archive/250345

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


FIX: Prefetching of Rows by Bookmark Lookup May Not Release Locks in Read Committed Isolation

Article ID: 250345

Article Last Modified on 3/14/2006



APPLIES TO

  • Microsoft SQL Server 7.0 Standard Edition



This article was previously published under Q250345

BUG #: 57204 (SQLBUG_70)

SYMPTOMS

Under the Read Committed isolation level, if the execution plan of a SELECT statement chooses to do a Bookmark Lookup, Intent Shared (IS) or Shared (S) locks may not be released after the execution of the SELECT statement has completed.

For this behavior to occur, the following three conditions must be true:

  • The base table must have a clustered index and a non-clustered index.
  • Selected columns must include at least one column that does not have an index.
  • The SELECT statement must elect to return the data through the non-clustered index bookmark. This commonly occurs with the use of ORDER BY and LIKE clauses.


CAUSE

While prefetching rows from the base table, the Bookmark Lookup does not release the locks held on the base table.

WORKAROUND

To work around this problem, avoid performing SELECT operations while in a transaction or use an index hint to force the clustered index. For example, you can do the following to force the clustered index:

select * from (index = 1) TEST1 order by C2
                

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0


For more information, contact your primary support provider.

MORE INFORMATION

Bookmark Lookups allow fast random access to rows based on a bookmark value. A Bookmark Lookup uses the bookmark, which can be a row ID or a clustered key, to look up the corresponding row in table or clustered key.

The following example query plan generated by SQL Server uses a Bookmark Lookup with PREFETCH:

StmtText
                                                                                   
---------------------------------------------------------------------------------------------

  |--Bookmark Lookup(BOOKMARK:([Bmk1000]), OBJECT:([Northwind].[dbo].[TEST1]) WITH PREFETCH)

       |--Index Scan(OBJECT:([Northwind].[dbo].[TEST1].[CLUSTIND]), ORDERED)
                


Additional query words: locks isolation read committed

Keywords: kbbug kbfix KB250345