Faith Wins
Faith Wins

Reputation: 411

Force a stored procedure to run single threaded

I have a stored procedure running on a multi-core system. It is executed in multi-threaded way. Due to, may be, some thing in the query, execution of some of the threads hangs forever with cx_packet wait and lock. Is there a way to force single threaded execution? (I know that is not the best solution, but is helpful until at least the query is better optimized.)

Upvotes: 2

Views: 7999

Answers (1)

Martin Smith
Martin Smith

Reputation: 453278

You can add OPTION (MAXDOP 1) to the statements that you want to run single threaded. Example

SELECT *
FROM master..spt_values
OPTION (MAXDOP 1)

Upvotes: 6

Related Questions