SQL Server构建采样统计时,采样百分比是如何计算的?
例如,更新Stack Overflow 2013 数据库中dbo.Votes表的PostId列的统计信息:
UPDATE STATISTICS dbo.Votes
(
_WA_Sys_00000002_0AD2A005
)
WITH MAXDOP = 1;
SQL Server 构建一个内部语句:
SELECT
StatMan
(
[SC0],
[SB0000]
)
FROM
(
SELECT TOP 100 PERCENT
[SC0],
step_direction([SC0]) over (order by NULL) AS [SB0000]
FROM
(
SELECT [PostId] AS [SC0]
FROM [dbo].[Votes]
TABLESAMPLE SYSTEM (9.234204e-01 PERCENT)
WITH (READUNCOMMITTED)
) AS _MS_UPDSTATS_TBL_HELPER
ORDER BY
[SC0],
[SB0000]
) AS _MS_UPDSTATS_TBL
OPTION (MAXDOP 1)
它从哪里来9.234204e-01 PERCENT
?