sql-server - 即使 online=on ,索引重建也会卡住数据库

标签 sql-server azure azure-sql-database

我有一个托管在 Azure 上的 SQL 数据库,其大小为 712 Gb。

每当我尝试使用 (online=on) 重建索引时,网站会正常工作几分钟,然后卡住,DTU 达到 100%,我必须停止查询执行。即使重建单个索引也会发生这种情况。

我们的碎片非常多,我们需要定期重建索引。

我们有来自世界各地的用户访问该网站,因此很难找到非高峰时间并重建它。

有人可以提出解决方案吗?

最佳答案

我在 Guidelines for Online Index Operations 中读到可能需要设置 MAXDOP 来为其他事件保留一些处理器。

On multiprocessor computers that are running SQL Server 2016, index statements may use more processors to perform the scan and sort operations associated with the index statement just like other queries do. You can use the MAXDOP index option to control the number of processors dedicated to the online index operation. In this way, you can balance the resources that are used by index operation with those of the concurrent users.

假设您有八个处理器,您可以强制重建操作仅使用四个处理器:

... REBUILD WITH (ONLINE=ON,MAXDOP=4); 

关于sql-server - 即使 online=on ,索引重建也会卡住数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46014727/

相关文章:

sql - 如何根据电话号码找到长途费率的最佳匹配?

sql-server - 从应用于另一个表的条件中找到 ID 的 SQL 表中删除

java - REST API Azure 事件中心 ExpiredToken

Azure Service Fabric 出站 IP 地址

azure - 将 .bak 文件导入 Azure SQL 数据库

sql-server - sqlcmd : Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

sql-server - SQL 中常量的最佳模式?

Azure 服务总线队列一次仅接收 450 条消息

azure - 始终使用 Keyvault 加密 SQL Azure - 导出 CMK 证书

azure - 使用服务主体从 DataBricks 连接到 Azure SQL 数据库