在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机制。
本文转自 Fanr_Zh 博客园博客,原文链接:http://www.cnblogs.com/Amaranthus/archive/2011/12/09/2281870.html,如需转载请自行联系原作者