A major performance regression from when you upgraded 5.2.2 to 7.1.1

未关闭
#4,985 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 2 天内回复

@cheenamalhotra 已经在做这个了。

开始于 2026年11月4日。

  • #4988 来自 @cheenamalhotra —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

Performance :chart_with_upwards_trend: Regression :boom:
Describe the bug

A major performance regression from when you upgraded 5.2.2 to 7.1.1.
We have a service that bulk loads data from files to hundreds of tables across hundreds of databases as a core part of our operation.
Since the upgrade to 7.1.1 our CPU usage went up 20% and the leading statements running against our DB (based off of Query Store and sys.dm_exec_request) are:
35% of all CPU usage on the server:

SELECT @Column_Names = COALESCE(@Column_Names + '', '', '''') + QUOTENAME([name]) FROM .[sys].[all_columns] WHERE [object_id] = @Object_ID AND COALESCE([graph_type], 0) NOT IN (1, 3, 4, 6, 7) ORDER BY [column_id] ASC

11% of all CPU usage on the server:

IF EXISTS (SELECT TOP 1 * FROM .[sys].[all_columns] WHERE [object_id] = OBJECT_ID($) AND [name] = $)

4% of all CPU usage on the server:

SELECT [Canonical_Column_Name], [Aliased_Column_Name]
FROM #Column_Aliases
ORDER BY [Canonical_Column_Id] ASC
To reproduce

This is our data loading code fragment

using (SqlBulkCopy bc = new SqlBulkCopy(connectionString, SqlBulkCopyOptions.CheckConstraints | SqlBulkCopyOptions.FireTriggers))
{
    foreach (DataColumn col in dt.Columns)
    {
        bc.ColumnMappings.Add(col.ColumnName.ToUpper(), col.ColumnName.ToUpper());
    }
    bc.DestinationTableName = TableName;
    bc.BulkCopyTimeout = 0;
    bc.WriteToServer(dt);
    bc.Close();
}
Further technical details

Microsoft.Data.SqlClient version: 7.1.1
.NET target: .NET 10
SQL Server version: SQL 2025 CU 9
Operating system: mcr.microsoft.com/dotnet/aspnet:10.0

主要语言
C#
星标
1k
派生
352
平均合并
4 天 8 小时
30 天内合并 PR
104

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dotnet/SqlClient 的其他 Issue

查看 dotnet/SqlClient 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。