KB982376 - FIX: A non-yielding scheduler error or an error 8623 occurs when you run a query that contains a large IN clause in SQL Server 2005, SQL Server 2008, or SQL Server 2008 R2

Applies To
Microsoft SQL Server 2005 SQL Server 2008 SQL Server 2008 R2

Microsoft distributes Microsoft SQL Server 2005, Microsoft SQL Server 2008, or Microsoft SQL Server 2008 R2 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous Microsoft SQL Server 2005, Microsoft SQL Server 2008, or Microsoft SQL Server 2008 R2 fix release.

Symptoms

In Microsoft SQL Server 2005, Microsoft SQL Server 2008, or Microsoft SQL Server 2008 R2, you have a query that contains a large IN clause. For example, the IN clause contains thousands of values. When you run this query, a non-yielding scheduler error may occur. Additionally, a mini-dump file is generated in the SQL Server 2005, SQL Server 2008, or SQL Server 2008 R2 log folder. Sometimes you may also see the following error message in the SQL Server Error log file:

Note

Error: 8623, Severity: 16, State: 1.

The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.

Note If Error 8623 occurs together with the non-yielding scheduler error, the execution of the query fails.

Cause

This problem occurs because of an issue in the SQL Server code base. During the execution of the query that contains the large IN clause, the SQL Server code base does not yield a scheduler appropriately. This behavior causes CPU starvation for other worker threads that run on the same scheduler and causes a non-yielding scheduler error.

Resolution

Cumulative update information

SQL Server 2005

The fix for this issue was first released in Cumulative Update 10. For more information about how to obtain this cumulative update package for SQL Server 2005, click the following article number to view the article in the Microsoft Knowledge Base:

983329 Cumulative update package 10 for SQL Server 2005 Service Pack 3Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

960598 The SQL Server 2005 builds that were released after SQL Server 2005 Service Pack 3 was released

SQL Server 2008 Service Pack 1

The fix for this issue was first released in Cumulative Update 9 for SQL Server 2008 Service Pack 1. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:

2083921 cumulative update 9 for SQL Server 2008 Service Pack 1Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. Microsoft recommends that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

970365 The SQL Server 2008 builds that were released after SQL Server 2008 Service Pack 1 was released Microsoft SQL Server 2008 hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2008 Service Pack 1 hotfix to an installation of SQL Server 2008 Service Pack 1. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack.

SQL Server 2008 Service Pack 2

The fix for this issue was first released in Cumulative Update 1 for SQL Server 2008 Service Pack 2. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:

2289254 Cumulative update 1 for SQL Server 2008 Service Pack 2Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2402659 The SQL Server 2008 builds that were released after SQL Server 2008 Service Pack 2 was released

SQL Server 2008 R2

The fix for this issue was first released in Cumulative Update 3. For more information about how to obtain this cumulative update package for SQL Server 2008 R2, click the following article number to view the article in the Microsoft Knowledge Base:

2261464 Cumulative update package 3 for SQL Server 2008 R2Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

981356 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 was released

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:

http:⁠//support.microsoft.com/contactus/?ws=support Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Note After you install this hotfix, if the IN clause is large enough, error 8623 will still occur because of resource exhaustion. If error 8623 still occurs after you install this hotfix, use one of the following methods:

Method 1

Decrease the number of the values in the IN clause.

Method 2

Input the values in the IN clause into a temporary table or a table variable, and then query the result set that joins the original table and the temporary table (or table variable).

Prerequisites

You must have SQL Server 2005 Service Pack 3 (SP3), SQL Server 2008, or SQL Server 2008 R2 installed to apply this hotfix.

Restart requirement

You must restart the computer after you apply this hotfix if one of the SQL Server services is running when you apply this hotfix. If you do not want to restart the computer, stop all the SQL Server services before you apply this hotfix.

Hotfix replacement information

This hotfix does not replace any other hotfixes.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

x86-based versions of SQL Server 2005

File name File version File size Date Time Hashes
Batchparser90.dll 2005.90.4035.0 125,280 24-Nov-2008 16:14
Dbghelp.dll 6.6.7.5 1,037,152 24-Nov-2008 14:51 MD5: 288A3127F85C9416E9A3FD07EDAEDCBD
SHA1: FC10D9E27E5C6987B5CB2C5166FBF83252AC41FC
Dumpdatastore.dll 2005.90.4035.0 1,157,472 24-Nov-2008 14:56 MD5: 9B010B4FF41DA4AFAFB94C8456D64059
SHA1: 58783B12982DFACF3D9AF4A1CAFE58A95771CE3D
Msvcp80.dll 8.0.50727.42 548,864 13-Oct-2005 16:26 MD5: 2BC650257FB0867ABD54FD460EC2BAFC
SHA1: EC063526AA14BCADEEFFA6D859B39A80680015B7
Msvcr80.dll 8.0.50727.42 626,688 13-Oct-2005 16:26 MD5: 16D7DDF3B659F7CF1CB9F4DCFF4219F0
SHA1: A61454131940799F01C26943F1594EE6E7409D11
Sqlcmd.exe 2005.90.4035.0 141,664 24-Nov-2008 15:31 MD5: 2E1B8DF1802612BDA20378B612D46155
SHA1: B45271F4CA358805D3515ADB9DA8D302FA40D8D0
Sqlcmd.rll 2005.90.4035.0 24,928 24-Nov-2008 15:14 Not Applicable
Sqldiscoveryapi.dll 2005.90.4035.0 530,784 24-Nov-2008 15:31 MD5: 8AC29B7DF7AA97CF12E15BF4D026A96D
SHA1: 7DF7C8A0AFFC7EEE19CCA8C321494395DA06CD5C
Sqlsetupvista.dll 2005.90.4035.0 227,680 24-Nov-2008 15:31 MD5: FF9AF51AD873841628C0F5554BD7EB8E
SHA1: B538EFC458163E6D04056B1F191B13EF891BA50E
Finalsql2005information.rtf Not Applicable 844 14-Jan-2010 14:37 Not Applicable
Sqlhotfix.chm Not Applicable 116,106 14-Jan-2010 14:37 Not Applicable
Sqlse.rll 1.4.1581.0 60,264 07-Apr-2010 16:40 Not Applicable
Sqlrun_as.msp Not Applicable 27,555,328 08-Apr-2010 01:26 Not Applicable
Sqlrun_dts.msp Not Applicable 14,836,736 08-Apr-2010 01:28 Not Applicable
Sqlrun_ns.msp Not Applicable 3,965,952 08-Apr-2010 01:28 Not Applicable
Sqlrun_rs.msp Not Applicable 16,354,304 08-Apr-2010 01:31 Not Applicable
Sqlrun_sql.msp Not Applicable 39,590,400 08-Apr-2010 01:36 Not Applicable
Sqlrun_tools.msp Not Applicable 48,827,904 08-Apr-2010 01:46 Not Applicable

x64-based versions of SQL Server 2005

File name File version File size Date Time Hashes
Batchparser90.dll 2005.90.4035.0 179,552 25-Nov-2008 04:38
Dbghelp.dll 6.6.7.5 1,326,944 25-Nov-2008 04:38 MD5: 1F5B11622850EBFEA889A8B6F1132F57
SHA1: 68B256D48B40C58FD67DADBC815F443C826BE073
Dumpdatastore.dll 2005.90.4035.0 1,566,560 25-Nov-2008 04:39 MD5: D3D83B642E6D906918A4527B04E82CA1
SHA1: FADA34561343B9A1B2313335690B2B881E237678
Msvcp80.dll 8.0.50727.42 1,097,728 14-Oct-2005 04:46 MD5: 5AE0F01F02A03558DA0CBD249E4DF263
SHA1: 64735AB4635B587647A11A599E39D2233D9DE6F0
Msvcr80.dll 8.0.50727.42 822,784 14-Oct-2005 04:46 MD5: 465CEBD7DA2CEABA5E552FC9118A1415
SHA1: 995060CABE3DDF199B400AD0D80FF5660626793C
Sqlcmd.exe 2005.90.4035.0 336,736 25-Nov-2008 04:45 MD5: 105FAD078031DF182E32C53D5994C457
SHA1: D8953F00436F38880B4B587391BD0D2309E5297E
Sqlcmd.rll 2005.90.4035.0 25,440 25-Nov-2008 04:40 Not Applicable
Sqldiscoveryapi.dll 2005.90.4035.0 750,432 25-Nov-2008 04:45 MD5: 0826CE00BFB5DA7374E4D0E146942471
SHA1: 668553462BD285FBDC241A23E4E259FEF1235DEF
Sqlsetupvista.dll 2005.90.4035.0 316,256 25-Nov-2008 04:45 MD5: 41BBA84E4D204046EF0059E573B98988
SHA1: 557F186F46D09AE59C655B52675D604593E8E611
Finalsql2005information.rtf Not Applicable 844 14-Jan-2010 14:37 Not Applicable
Sqlhotfix.chm Not Applicable 116,106 14-Jan-2010 14:37 Not Applicable
Sqlse.rll 1.4.1581.0 60,776 07-Apr-2010 17:33 Not Applicable
Sqlrun_as.msp Not Applicable 46,118,400 08-Apr-2010 01:15 Not Applicable
Sqlrun_dts.msp Not Applicable 22,150,656 08-Apr-2010 01:18 Not Applicable
Sqlrun_ns.msp Not Applicable 5,689,344 08-Apr-2010 01:19 Not Applicable
Sqlrun_rs.msp Not Applicable 21,256,192 08-Apr-2010 01:22 Not Applicable
Sqlrun_sql.msp Not Applicable 45,197,312 08-Apr-2010 01:28 Not Applicable
Sqlrun_tools.msp Not Applicable 65,248,768 08-Apr-2010 01:38 Not Applicable

IA-64-based versions of SQL Server 2005

File name File version File size Date Time Hashes
Batchparser90.dll 2005.90.4035.0 293,728 24-Nov-2008 19:52
Dbghelp.dll 6.6.7.5 3,631,456 24-Nov-2008 19:52 MD5: BB797393886A04ED2847AC966A23439D
SHA1: B43F7926C0FD268F4496A116B9176753601B5EAD
Dumpdatastore.dll 2005.90.4035.0 4,322,144 24-Nov-2008 19:47 MD5: 5677EC5C5DA9AB7C71580996E598433E
SHA1: A98591A4D220C293A6C8E1D2B17E3C4847545721
Msvcp80.dll 8.0.50727.42 1,385,472 14-Oct-2005 04:35 MD5: 7F0715E63E08692F39C017A6A2D61E56
SHA1: 24B674285AC11D0496529EBC9E7FADC7B7955AC3
Msvcr80.dll 8.0.50727.42 1,484,800 14-Oct-2005 04:35 MD5: 88B3570029DEC94B06199DB8E7EB66D9
SHA1: FC8EE955B19FCE0F4F1C8F17F9AD97ACB4E129A4
Sqlcmd.exe 2005.90.4035.0 530,784 24-Nov-2008 20:03 MD5: 512C6ECF02979B75B5C52D5F3021C379
SHA1: 03A8D2BE83EFF1ACE5B002D5E390670B1EF14D83
Sqlcmd.rll 2005.90.4035.0 24,416 24-Nov-2008 19:58 Not Applicable
Sqldiscoveryapi.dll 2005.90.4035.0 1,939,808 24-Nov-2008 20:04 MD5: 63834474BB3D9B15958A40B0FF102F93
SHA1: F00BE0A455B134CF17FF6C9FBCF19D93BC6F403B
Sqlsetupvista.dll 2005.90.4035.0 702,816 24-Nov-2008 20:04 MD5: 593F2B3BD7C92AEF28A751D5C4421C84
SHA1: 58D55D1822E697D701F9B45A50A6A5B67B998E77
Finalsql2005information.rtf Not Applicable 844 14-Jan-2010 14:37 Not Applicable
Sqlhotfix.chm Not Applicable 116,106 14-Jan-2010 14:37 Not Applicable
Sqlse.rll 1.4.1581.0 59,240 07-Apr-2010 20:04 Not Applicable
Sqlrun_as.msp Not Applicable 67,258,368 08-Apr-2010 00:57 Not Applicable
Sqlrun_dts.msp Not Applicable 35,875,328 08-Apr-2010 01:01 Not Applicable
Sqlrun_ns.msp Not Applicable 12,269,056 08-Apr-2010 01:02 Not Applicable
Sqlrun_rs.msp Not Applicable 31,128,576 08-Apr-2010 01:06 Not Applicable
Sqlrun_sql.msp Not Applicable 69,868,032 08-Apr-2010 01:13 Not Applicable
Sqlrun_tools.msp Not Applicable 65,883,648 08-Apr-2010 01:23 Not Applicable

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References

For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates