FIX: Suboptimal Performance Using a Cursor to Update a Heap Involved in an Indexed View (282982)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q282982
BUG #: 351566 (SHILOH_bugs)

SYMPTOMS

Using a cursor to update a table may result in a long execution time under the following circumstances:
  • There is an indexed view that involves the table being updated.
  • The table being updated does not have a clustered index.
  • A cursor is used to perform the update.

CAUSE

An incorrect join order is chosen during the optimization phase.

RESOLUTION

To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack

WORKAROUND

Any of the following changes will reduce the changes of encountering the problem:
  • Rewrite the update query to avoid cursor use.
  • Add a clustered index on all underlying tables.
  • Remove any unnecessary indexes on the view.

STATUS

Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.

Modification Type:MajorLast Reviewed:10/16/2003
Keywords:kbBug kbfix kbSQLServ2000sp1fix KB282982