Symptoms
Consider the following scenarios:
-
You create partitions for a table in Microsoft SQL Server 2008 R2 or in Microsoft SQL Server 2012.
-
You create an AFTER trigger for any INSERT or DELETE operation that is performed on the table.
-
You perform an INSERT or DELETE operation on the table.
In this scenario, slow performance might occur. Additionally, many logical reads might occur if you run SQL Profiler.
Cause
This issue occurs for the following reasons:
-
The Storage Engine internally maintains a single version chain for each statement.
-
The query execution searches for the partitions of the whole version chain to find the rows that are inserted for one of the partitions.
Resolution
To resolve this issue, apply the following hotfix and then use the -T2470 trace flag
Cumulative update information
SQL Server 2012 The fix for this issue was first released in Cumulative Update 1 for SQL Server 2012. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:
2679368 Cumulative update package 1 for SQL Server 2012Note 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 2012 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:
2692828 The SQL Server 2012 builds that were released after SQL Server 2012 was released You must apply a SQL Server 2012 hotfix to an installation of SQL Server 2012.
SQL Server 2008 R2 Service Pack 1
Cumulative update information
The fix for this issue was first released in Cumulative Update 3 for SQL Server 2008 R2 Service Pack 1. For more information about how to obtain this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:
2591748 Cumulative Update package 3 for SQL Server 2008 R2 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 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:
2567616 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 Service Pack 1 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 website:http://support.microsoft.com/contactus/?ws=supportNote 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.
Prerequisites
To apply this hotfix, you must have Microsoft SQL Server 2008 R2 Service Pack 1 (SP1) installed.
Restart requirement
You do not have to restart the computer after you apply this hotfix.
Hotfix replacement information
This hotfix does not replace a previously-released hotfix.
File information
The global version of this 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.
For all supported x86-based versions of SQL Server 2008 R2 SP1
File name |
File version |
File size |
Date |
Time |
Platform |
---|---|---|---|---|---|
Sqlservr.exe |
2009.100.2776.0 |
43,053,920 |
15-Sep-2011 |
01:47 |
x86 |
For all supported x64-based versions of SQL Server 2008 R2 SP1
File name |
File version |
File size |
Date |
Time |
Platform |
---|---|---|---|---|---|
Sqlservr.exe |
2009.100.2776.0 |
62,176,608 |
15-Sep-2011 |
00:57 |
x64 |
For all supported IA-64–based versions of SQL Server 2008 R2 SP1
File name |
File version |
File size |
Date |
Time |
Platform |
---|---|---|---|---|---|
Sqlservr.exe |
2009.100.2776.0 |
122,105,696 |
15-Sep-2011 |
00:23 |
IA-64 |
Workaround
To work around this issue, change the AFTER trigger to an INSTEAD OF INSERT trigger or to an INSTEAD OF DELETE trigger.
For example, you run the following statements to create an AFTER trigger:
CREATE TRIGGER TR_Test ON Test FOR INSERT AS BEGIN DECLARE @groupe INT SELECT TOP 1 @groupe=Groupe FROM INSERTED END GOIn this scenario, change the AFTER trigger to INSTEAD OF INSERT by using the following statements:
CREATE TRIGGER TR_Test ON Test INSTEAD OF INSERT AS BEGIN DECLARE @groupe INT SELECT TOP 1 @groupe=Groupe FROM INSERTED INSERT INTO Test (Groupe) SELECT @groupe FROM INSERTED END
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.