Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 52420632E37 for ; Wed, 10 Feb 2010 01:10:48 -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 44640-05 for ; Wed, 10 Feb 2010 05:10:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f228.google.com (mail-bw0-f228.google.com [209.85.218.228]) by mail.postgresql.org (Postfix) with ESMTP id AF3D063265C for ; Wed, 10 Feb 2010 01:10:37 -0400 (AST) Received: by bwz28 with SMTP id 28so6187527bwz.34 for ; Tue, 09 Feb 2010 21:10:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=sxRRTVDORfOyB+r7YMjxc5ggkjuiINbeI1Q0JY2rWfU=; b=gBcbGe6M0cv5+uRy9Aj/QBoiUzEqpGJpydWOnpAY8zU04H2lW9n9LK4TICx0T5vvKK v7LcFMTn2rl9Ht5T5F3j6DxOank7L8iWcxkAsHHEYj9zIV06AJYukQgELsdWtpXVmL7y hBmBU56cj/25MgVO4YXXtl17HPOnyx6IdRhQU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=UoxYhbwErI5wVHh581iZnB9s9QSKR/w4QntL4Dwi3GQqo7oPlS2vVOlzBqeRHAXaVI caLS3qtM8HFleDPh9c6JCDypr1Q3FceaOjVRJm0kAlxw2EKIqVAJLBQFvseeyPZRphQN JMG9vDHjf4lwZrjdRfaBXNNST+frPROEFizAY= MIME-Version: 1.0 Received: by 10.204.10.9 with SMTP id n9mr2176843bkn.41.1265778636369; Tue, 09 Feb 2010 21:10:36 -0800 (PST) Date: Wed, 10 Feb 2010 10:10:36 +0500 Message-ID: <8cac8dd1002092110q45411eb1j63bc1b3ce40f3d2e@mail.gmail.com> Subject: How exactly PostgreSQL allocates memory for its needs? From: Anton Maksimenkov To: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 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/149 X-Sequence-Number: 37570 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? -- antonvm