SYMPTOMS
When you try to run a query on a multiprocessor computer, the query may stop responding or you may receive an error message if both of the following conditions are true:
- The max degree of parallelism option for your instance of Microsoft SQL Server 2000 Service Pack 3 (SP3) is set to 0 or to a number that is greater than 1.
- The query uses intra-query parallelism on a multiprocessor computer.
You may receive
the following error message:
Msg 8650:
Intra-query parallelism caused your server command (process ID #50) to
deadlock. Rerun the query without intra-query parallelism by using the query
hint option (maxdop 1).
WORKAROUND
To work around this problem, use one of the following
methods:
Method 1: Enable the pre-SQL
Server 2000 SP3 parallel scan behavior
To work around this error message, enable the pre-SQL
Server 2000 SP3 parallel scan behavior, and then run the SQL Server query on
the multiprocessor computer. To enable the pre-SQL Server 2000 SP3 parallel
scan behavior, enable trace flag 683 that is included in SQL
Server post-SP3 hotfix builds 8.00.0765 or later. To enable trace flag 683,
follow these steps:
- Start SQL Query Analyzer, and then connect to your instance
of SQL Server.
- Run the following
Transact-SQL statement in SQL Query Analyzer:
DBCC TRACEON (683)
Method 2: Run the query again
When this problem occurs, you can try to run the query again.
If an application that is running SQL Query Analyzer receives the error message, you must
configure the application to run the query one or more times when the problem occurs.
If you receive the error message when you run a SQL
Server job, such as a replication job, you can add a job step to run the
query again when the problem occurs.
Method 3: Use the loop or merge join strategy
To avoid a deadlock when a query execution plan uses intra-query parallelism, add the OPTION (MERGE JOIN, LOOP JOIN) query hint to your parallel query.
Method 4: Suppress the generation of a parallel plan
To avoid a deadlock, suppress the generation of
a query execution plan that uses intra-query parallelism. To do so, use one
of the following methods:
Method 5: Rewrite the query
To work around this problem, rewrite the query to reduce the chance that a deadlock will occur.
Method 6: Perform general performance tuning
You can perform general performance tuning for your query or
your SQL Server database. To significantly improve query performance and to reduce the chance that a deadlock will occur, you can create or update the column statistics and
indexes. You must evaluate the indexes on the tables that are
involved in your query, and you must also run the UPDATE STATISTICS Transact-SQL
statement on your instance of SQL Server. For more information about
query tuning in SQL Server 2000, see the following topics in SQL Server Books
Online:
- Query tuning
- Query tuning recommendations
- Parallel query recommendations