SQL Server 2012 中序列的自动缓存大小

Automatic cache sizing for sequences in SQL Server 2012

我试图使用下面的 T-SQL 脚本在 SQL Server 2012 中创建一个序列:

Create Sequence ConteoCycling  
AS int   
START WITH 2
MINVALUE 0
MaxVALUE 4
INCREMENT BY 1   
GO

我给了它一个最小 (0) 和最大 (4) 范围值,以便它在给定范围用完后自行回收。成功创建后,我在 SQL Server Management Studio 的输出 window 的消息选项卡中看到以下消息。这条消息是我的困惑点:

cache size is greater than the number of available values; the cache
size has been automatically set to accommodate the remaining sequence values.

所以消息说它能够自动设置缓存大小。但是,当我从对象资源管理器进入序列的属性 window 时,它没有显示任何特定的缓存大小,但选择了 Default size 缓存选项,如下面的快照所示:

我的问题是 -

根据我为我的序列选择的范围如果 SQL 服务器引擎能够通过此序列以某种方式猜测 运行 所需的缓存大小那么它为什么不设置特定的改为尺寸。

为什么它仍然显示选择了 Default Size 选项?如果设置为 Default Size 选项,它本质上是动态的吗?如果有人能告诉我 SQL 服务器引擎在其创建和回收过程中在序列的缓存大小方面在幕后做什么,那就太好了?

This message is my point of confusion :

cache size is greater than the number of available values; the cache size has been automatically set to accommodate the remaining sequence values

消息(斜体)不正确。请参阅为此提出的connect item,我无法再在 SQLServer 2016 上重现该问题开发者版。

Connect 项目中的相关项目:

Thanks for reporting this. The behavior is overall correct. The message is meant as a hint that the cache size is greater than the number of remaining sequence values. In fact we are not storing a different value for the cache size than the one specified in the alter/create sequence statement.

The actual bug here is the message stating something else. We will fix this for a future release.

Posted by Jan [MSFT] on 4/27/2012 at 9:41 AM
Thanks again for reporting this issue. We have fixed the message and the fix will be available in a future update of SQL Server.

消息我正在为您的测试场景获取 SQL2016 开发人员版本..

The sequence object 'ConteoCycling' cache size is greater than the number of available values.