我们最近将许多实例升级到 2016 年。因此,来自sqlpackage.exe的 SELECT 语句在某些实例上超时。
经过一些测试,我发现通过更新执行计划中显示的数据库系统表的统计信息,SELECT 停止了超时。
update statistics sys.[sysclsobjs] with fullscan
update statistics sys.[syscolpars] with fullscan
update statistics sys.[sysidxstats] with fullscan
update statistics sys.[sysiscols] with fullscan
update statistics sys.[sysobjvalues] with fullscan
Run Code Online (Sandbox Code Playgroud)
无论如何,是否可以通过标准维护包、Ola Hallengren 的脚本或其他一些过程来仅更新系统表统计信息?
08/01 更新
以下是我升级后的步骤
关于 4199 跟踪标志KB974006
-- for the instance
/*
Turn on traceflag 4199 (my understanding of this traceflag is that it disables
optimizer hotfixes in 2016
*/
-- disable automatic numa
sp_configure 'automatic soft-NUMA disabled', 1
GO
-- For each …Run Code Online (Sandbox Code Playgroud)