Postgresql – Memory usage of PostgreSQL

memorypostgresqlpostgresql-9.3

I'm using postgreSQL 9.3 database and I have increased the shared_buffers and effective_cache_size in the settings.

Will postgreSQL always take this amount of memory or only when needed?

I'm running my database on an Amazon EC2 instance and I will monitor the memory with a CloudWatch custom metric and I'm now thinking about it if the memory I set in the configuration will always be reserved i.e. appears to be used in the cloudWatch metric.

If this is the case, how can I monitor the actual used memory of postgreSQL?

Best Answer

shared_buffers are statically taken at startup and are never resized. effective_cache_size is just a hint to the optimizer. it is never allocated. it merely gives a hint of what is going on. so shared_buffers is what you see as taken.