为什么统计计算机会自动开启?

vc6uscn9  于 2021-07-26  发布在  Java
关注(0)|答案(0)|浏览(193)

我正在运行sql server 13.0.5622.0。我有许多大型索引视图(>5mm行),定义如下:

CREATE VIEW MyView WITH SCHEMABINDING AS
  SELECT T1.Column1, T1.Column2
  FROM dbo.T1
  INNER JOIN dbo.T2 ON T2.Id = T1.Id
  WHERE T2.Column3 IS NULL
GO

CREATE UNIQUE CLUSTERED INDEX IX_MyView ON MyView
(
  Column1 ASC,
  Column2 ASC
) 
WITH (DATA_COMPRESSION = PAGE)
ON Primary
GO

创建视图和索引后,一切正常。当我几个小时后回来时,我运行以下代码(从how do i find index that have statistics\u norecompute=on)

SELECT 
  OBJECT_NAME(i.object_id) AS table_name,
  i.name AS index_name,
  s.name
FROM sys.indexes AS i
LEFT JOIN sys.stats AS s ON
  i.index_id = s.stats_id
  AND i.object_id = s.object_id
WHERE s.no_recompute = 1

注意,由于某种原因,索引现在 STATISTICS_NORECOMPUTE = ON . 我编辑索引选项,设置 STATISTICS_NORECOMPUTE = OFF ,几个小时后当我再次检查时, STATISTICS_NORECOMPUTE 他回来了 ON 再一次。我找不到说明SQLServer将自动设置 STATISTICS_NORECOMPUTE = ON 或者在什么条件下这样做。有人知道为什么会这样吗?查询效率会受到影响吗 STATISTICS_NORECOMPUTE = ON ? 我是否应该设置一个后台作业,以便在设置的时间手动更新这些索引的统计信息?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题