system cache and buffer cache

Started by Praveen Kumar Nover 19 years ago6 messages
#1Praveen Kumar N
praveen_n@students.iiit.net

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

#2Heikki Linnakangas
heikki@enterprisedb.com
In reply to: Praveen Kumar N (#1)
Re: system cache and buffer cache

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

#3Praveen Kumar N
praveen_n@students.iiit.net
In reply to: Heikki Linnakangas (#2)
Re: system cache and buffer cache

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

#4Heikki Linnakangas
heikki@enterprisedb.com
In reply to: Praveen Kumar N (#3)
Re: system cache and buffer cache

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

#5Alvaro Herrera
alvherre@commandprompt.com
In reply to: Praveen Kumar N (#1)
Re: system cache and buffer cache

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.

#6Simon Riggs
simon@2ndquadrant.com
In reply to: Heikki Linnakangas (#4)
Re: system cache and buffer cache

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