Re: How exactly PostgreSQL allocates memory for its needs?

From: Justin Graf <justin(at)magwerks(dot)com>
To: pgsql-performance(at)postgresql(dot)org, anton200(at)gmail(dot)com
Subject: Re: How exactly PostgreSQL allocates memory for its needs?
Date: 2010-02-10 16:43:43
Message-ID: 4B72E23F.9040005@magwerks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 2/10/2010 12:10 AM, Anton Maksimenkov wrote:
> Can anybody briefly explain me how each postgres process allocate
> memory for it needs?
> I mean, what is the biggest size of malloc() it may want? How many
> such chunks? What is the average size of allocations?
>
> I think that at first it allocates contiguous piece of shared memory
> for "shared buffers" (rather big, hundreds of megabytes usually, by
> one chunk).
> What next? temp_buffers, work_mem, maintenance_work_mem - are they
> allocated as contiguous too?
> What about other needs? By what size they are typically allocated?
>

There is no short answer to this, you should read section 18 of the manual
http://www.postgresql.org/docs/8.4/interactive/runtime-config.html
specifically section 18.4
http://www.postgresql.org/docs/8.4/interactive/runtime-config-resource.html

and performance section of the wiki
http://wiki.postgresql.org/wiki/Performance_Optimization

Here is a link annotated postgresql.conf
http://www.pgcon.org/2008/schedule/attachments/44_annotated_gucs_draft1.pdf

Keep in mind each connection/client that connecting to the server
creates a new process on the server. Each one the settings you list
above is the max amount of memory each one of those sessions is allowed
to consume.

All legitimate Magwerks Corporation quotations are sent in a .PDF file attachment with a unique ID number generated by our proprietary quotation system. Quotations received via any other form of communication will not be honored.

CONFIDENTIALITY NOTICE: This e-mail, including attachments, may contain legally privileged, confidential or other information proprietary to Magwerks Corporation and is intended solely for the use of the individual to whom it addresses. If the reader of this e-mail is not the intended recipient or authorized agent, the reader is hereby notified that any unauthorized viewing, dissemination, distribution or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and destroy all occurrences of this e-mail immediately.
Thank you.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff 2010-02-10 17:22:57 Re: Linux I/O tuning: CFQ vs. deadline
Previous Message David Boreham 2010-02-10 16:10:31 Re: [PERFORM] PostgreSQL - case studies