Thread: system cache and buffer cache
Hi, can anybody explain me what is the difference between system cache and buffer cache? I found that keywords in PostgreSql FAQ http://www.postgresql.org/docs/faqs.FAQ_DEV.html#item2.1 thanks in advance. Regards, -- N Praveen Kumar Imagination is more important than knowledge... --Albert Einstein
Praveen Kumar N wrote: > Hi, > can anybody explain me what is the difference between system cache > and buffer cache? > > I found that keywords in PostgreSql FAQ > http://www.postgresql.org/docs/faqs.FAQ_DEV.html#item2.1 System cache is a per-row cache of system catalog tables. It's used to speed up lookup of things like function names. It's implemented in src/backend/utils/cache/syscache.c Buffer cache is the cache managed by the buffer manager, that caches any blocks from any relation used in the system. All access to relations go through the buffer cache, using ReadBuffer/ReleaseBuffer (etc.) calls. It's implemented in src/backend/storage/buffer/bufmgr.c -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
Buffer cache is implemented using bufferpool right(I mean in the main memory).how about system cache? Can we control the size of system cache? On Tue, 19 Sep 2006, Heikki Linnakangas wrote: > System cache is a per-row cache of system catalog tables. It's used to speed > up lookup of things like function names. It's implemented in > src/backend/utils/cache/syscache.c > > Buffer cache is the cache managed by the buffer manager, that caches any > blocks from any relation used in the system. All access to relations go > through the buffer cache, using ReadBuffer/ReleaseBuffer (etc.) calls. It's > implemented in src/backend/storage/buffer/bufmgr.c > > -- N Praveen Kumar Btech-IV CSE IIIT,Hyd AP,India Imagination is more important than knowledge... --Albert Einstein
Praveen Kumar N wrote: > Buffer cache is implemented using bufferpool right(I mean in the main > memory). Yes. It's in shared memory, size is controlled by the shared_buffers configuration parameter. > how about system cache? Can we control the size of system cache? It's in backend-private memory. I don't remember how it's sized. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
Praveen Kumar N wrote: > Hi, > can anybody explain me what is the difference between system cache > and buffer cache? > > I found that keywords in PostgreSql FAQ > http://www.postgresql.org/docs/faqs.FAQ_DEV.html#item2.1 Another important cache is the "relation cache", relcache for short, which is also stored in local memory. One important point about these (relcache, syscache, catcaches = catalog caches) is that they are invalidated using the "sinval" system, which passes messages from one backend to all others via a queue in shared memory. The buffer cache needs no such thing, precisely because it lives in shared memory. But it needs to be protected by locks. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.
On Tue, 2006-09-19 at 14:59 +0100, Heikki Linnakangas wrote: > Praveen Kumar N wrote: > > how about system cache? Can we control the size of system cache? > > It's in backend-private memory. I don't remember how it's sized. It's fixed size: syscache caches a predefined set of catalog info. -- Simon Riggs EnterpriseDB http://www.enterprisedb.com