From: Justin Graf <justin@magwerks.com>
To: pgsql-performance@postgresql.org
To: anton200@gmail.com
Subject: Re: How exactly PostgreSQL allocates memory for its needs?
Date: Wed, 10 Feb 2010 11:43:43 -0500
Message-ID: <4B72E23F.9040005@magwerks.com> (raw)
In-Reply-To: <8cac8dd1002092110q45411eb1j63bc1b3ce40f3d2e@mail.gmail.com>
References: <8cac8dd1002092110q45411eb1j63bc1b3ce40f3d2e@mail.gmail.com>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: justin@magwerks.com, anton200@gmail.com
Subject: Re: How exactly PostgreSQL allocates memory for its needs?
In-Reply-To: <4B72E23F.9040005@magwerks.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox