SQL Server中 緩衝和池的不同點

來源:互聯網
上載者:User

在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機制。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.