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

This article was previously published under Q250345
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 57204 (SQLBUG_70)
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.
While prefetching rows from the base table, the Bookmark Lookup does not release the locks held on the base table.
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				
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.
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)				
locks isolation read committed

Article ID: 250345 - Last Review: 10/20/2013 16:53:12 - Revision: 2.1

Microsoft SQL Server 7.0 Standard Edition

  • kbnosurvey kbarchive kbbug kbfix KB250345