SQL Server中 缓冲和池的不同点

系统 1824 0

在SQL Server中存储方式主要分为2大类 缓冲和池。都是用来临时存放数据的,到底有什么不同。一直很恼人。

有幸看到一位大牛的博客,截取了其中讲述cache 和 pool的不同点。

Before we jump into further description of stores I would like to explain a difference between meanings of caches and pools. In SQLOS's world, cache is a mechanism to cache heterogeneous type of data with a given cost for each entry. Usually there is a given state associated with an entry. A cache implements lifetime control of an entry, its visibility, and provide some type of LRU policies. Depending on the type of the data cached each entry could be used by multiple clients at the same time. For example SQL Server procedure cache is a  cache in SQLOS' s terms. A plan's lifetime, visibility and cost is controlled by SQLOS's cache mechanism. Each plan can be used by multiple batches at the same time.

 

Cache 可以存放不同的数据类型的数据,并且备份存储实体都有一个花费值(cost)。 和状态值,可见度,还有一个生命周期,使用一些LRU算法来维护。每个实体都可以在同时被多个客户端访问。如SQL Server 存储Cache 是基于cache的,一个计划的生命周期,花费(cost)都是又SQLOS 的cache机制控制的。每个计划都可以被多个批处理(batches)同时访问。

 

In its turn, pool, in SQLOS's terms, is a mechanism for caching homogeneous data. In most cases cached data doesn't have neither state nor cost associated with it. A pool has limited control over lifetime of the entry and its visibility.  Once an entry is taken from the pool it is actually removed from it and pool no longer has any control over the entry until the entry is pushed back to the pool. Only one client can use an entry at the time. An example of a pool is a pool of network buffers: no state, no cost , all  buffers of the same size. Keep in mind SQL Server's Buffer Pool is a cache in SQLOS terms. Currently it doesn't use any of SQLOS's caching mechanism

 

Pool 用来存放相同的数据类型。在多数情况下存储的数据没有状态和花费(cost)。Pool可以控制存储实体的生命周期和可见度。一旦存储实体被读取,就从pool上面被删除了,除非再存入。pool中的实体同一时间只能又一个用户使用。如:network buffers是一个pool,没有状态,没有花费,所有的buffers大小都是相同的。在SQL Server中有一个 buffer pool,它是cache。但是却没有使用SQLOS的cache机制。

SQL Server中 缓冲和池的不同点


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论