Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 39A3B632BC5 for ; Wed, 10 Feb 2010 12:43:58 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 56859-06 for ; Wed, 10 Feb 2010 16:43:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.magwerks.com (mail.magwerks.com [209.248.233.131]) by mail.postgresql.org (Postfix) with ESMTP id 737EA6328D8 for ; Wed, 10 Feb 2010 12:43:45 -0400 (AST) Received: from [192.168.1.36] by mail.magwerks.com (GMS 15.01.3664/RS2750.00.1b502c7c) with ESMTP id bidudaaa for pgsql-performance@postgresql.org; Wed, 10 Feb 2010 11:43:44 -0500 Message-ID: <4B72E23F.9040005@magwerks.com> Date: Wed, 10 Feb 2010 11:43:43 -0500 From: Justin Graf User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20100111 Lightning/1.0b1 Thunderbird/3.0.1 MIME-Version: 1.0 To: pgsql-performance@postgresql.org, anton200@gmail.com Subject: Re: How exactly PostgreSQL allocates memory for its needs? References: <8cac8dd1002092110q45411eb1j63bc1b3ce40f3d2e@mail.gmail.com> In-Reply-To: <8cac8dd1002092110q45411eb1j63bc1b3ce40f3d2e@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-AntiSpam: Checked for restricted content by Gordano's AntiSpam Software X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/160 X-Sequence-Number: 37581 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.