Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jGphU-0007c4-0Q for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2020 19:59:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGphS-0006tD-CS for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2020 19:58:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jGphR-0006qV-UA for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2020 19:58:58 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jGphP-0007OA-Fj for pgsql-hackers@postgresql.org; Tue, 24 Mar 2020 19:58:56 +0000 Received: by mail-lj1-x242.google.com with SMTP id s13so37455ljm.1 for ; Tue, 24 Mar 2020 12:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=XGsNTtl41XEg4VSeh59sDjo6z+sMSTYHucHSpN++P7E=; b=M+7XzT+S4G7E9EgPSyjGav46UIFQMDlEmPx+294DPXB44MohSXrd/o8ZABq/I987vl NmbEfaAJukvVqgKOYOdqcsuio4xmlHmvxn3noXqzPuLg5J89LNtT908/7rgPugsw6BOs W4Vn/WQhNyuiG0InVqsBJzeQmmyusFWIclctZMLTQLVJkyuzGFwUCSUDBd2r99MAKzLL reL7/xifMi++40SScPGi3TuQaNrkU3sljH5OvncilqMFU5+cOGg//1yDNVK/jDbKoO+s TEpvCu5DfZ1ZHVjyfdMyz1msyca4ee4ZGWii1KHFPSb0+chms5NiKSbpjxbR5AD/3C58 kvWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=XGsNTtl41XEg4VSeh59sDjo6z+sMSTYHucHSpN++P7E=; b=oTcS9Jg/reNFJ02mrZRG5dvIZyMAMOX4H8OeVOkxoWknF6NAOMzIxFMRZi+jS5zs33 AHxLFLTUW0sNKJcCpwf6VuGwVSucVQ89XcUIv5yZ6YcidM4WhNwND/IVSCf92ThqJxYr B/S1dkVNuxQzwsDTSXFBttklzEc7wscet66zdqIe+NBxanGc5conHvuaAza9AdmIySoE GzVPlw5UyB16ana2BAxP8bZSZq9/KdbOvJ3TlqgtVPfeMRqvVm5uKJeSagXPE9twPls1 FOch0GiXmzfvY9Sj35doUhgi7Bx1SByRF+vM1ikJ8F1rD2qOwtywjwpKOLtdCirzORGW T++w== X-Gm-Message-State: ANhLgQ2sC/ve3ZIdZMT3NL5jL1X4NXeFZrMC0kGUGMnmUrVLbdsa9cMt 7fjOk5SnNiY5MaE5vbU2tnmgQul5c/4lRPb10QQ= X-Google-Smtp-Source: ADFU+vuZKo5nDgis84vVF+CODynCyazCbK5pRD4DYBzpDJXovTIr8Dj4q3d5F0CPmmrE3+no5L9dA4tOQdcql8bR1ns= X-Received: by 2002:a2e:b521:: with SMTP id z1mr18698318ljm.19.1585079933108; Tue, 24 Mar 2020 12:58:53 -0700 (PDT) MIME-Version: 1.0 References: <20200320001122.GA19602@alvherre.pgsql> <20200320195841.GA13662@telsasoft.com> In-Reply-To: From: Robert Haas Date: Tue, 24 Mar 2020 15:58:40 -0400 Message-ID: Subject: Re: Add A Glossary To: =?UTF-8?Q?J=C3=BCrgen_Purtz?= Cc: Justin Pryzby , Alvaro Herrera , Corey Huinker , Roger Harkavy , "pgsql-hackers@postgresql.org" , Fabien COELHO , Michael Paquier Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Mar 24, 2020 at 3:40 PM J=C3=BCrgen Purtz wrote: > On 24.03.20 19:46, Robert Haas wrote: > Do we use shared_buffers for WAL ? > > No. > > What's about the explanation in https://www.postgresql.org/docs/12/runtim= e-config-wal.html : "wal_buffers (integer) The amount of shared memory u= sed for WAL data that has not yet been written to disk. The default setting= of -1 selects a size equal to 1/32nd (about 3%) of shared_buffers, ... " ?= My understanding was, that the parameter wal_buffers grabs some of the exi= sting shared_buffers for its own purpose. Is this a misinterpretation? Are = shared_buffers and wal_buffers two different shared memory areas? Yes. The code adds up the shared memory requests from all of the different subsystems and then allocates one giant chunk of shared memory which is divided up between them. The overwhelming majority of that memory goes into shared_buffers, but not all of it. You can use the new pg_get_shmem_allocations() function to see how it's used. For example, with shared_buffers=3D4GB: rhaas=3D# select name, pg_size_pretty(size) from pg_get_shmem_allocations() order by size desc limit 10; name | pg_size_pretty ----------------------+---------------- Buffer Blocks | 4096 MB Buffer Descriptors | 32 MB | 32 MB XLOG Ctl | 16 MB Buffer IO Locks | 16 MB Checkpointer Data | 12 MB Checkpoint BufferIds | 10 MB clog | 2067 kB | 1876 kB subtrans | 261 kB (10 rows) rhaas=3D# select count(*), pg_size_pretty(sum(size)) from pg_get_shmem_allocations(); count | pg_size_pretty -------+---------------- 54 | 4219 MB (1 row) So, in this configuration, there whole shared memory segment is 4219MB, of which 4096MB is allocated to shared_buffers and the rest to dozens of smaller allocations, with 1876 kB left over that might get snapped up later by an extension that wants some shared memory. --=20 Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company