Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vLSEd-0005pE-16 for pgsql-general@arkaria.postgresql.org; Tue, 18 Nov 2025 20:23:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vLSEb-008jMK-2q for pgsql-general@arkaria.postgresql.org; Tue, 18 Nov 2025 20:23:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vLSEb-008jMC-1R for pgsql-general@lists.postgresql.org; Tue, 18 Nov 2025 20:23:29 +0000 Received: from mail-vk1-xa34.google.com ([2607:f8b0:4864:20::a34]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vLSEY-000Dn9-2v for pgsql-general@lists.postgresql.org; Tue, 18 Nov 2025 20:23:28 +0000 Received: by mail-vk1-xa34.google.com with SMTP id 71dfb90a1353d-5599688d574so1566189e0c.2 for ; Tue, 18 Nov 2025 12:23:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mokadb-com.20230601.gappssmtp.com; s=20230601; t=1763497407; x=1764102207; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IkTX2+CU8bWpu3V0xY0iFG4EWxCDjYf1Ak/ahWcH58o=; b=JXKMIGtt1kx+3hs36kGIeKhqtbQsYpeDgUQlm6NCCrqRyGbwgMopceGqE40hq9A2eR pVyG7VHmg30kjsJOxnmrmf1yEW/4wGHbSu6rs23QCyuWOa8e/Kjkg0aakHwIhB/1uSX+ aEr8iQgMtBaJTMUUbUpdX//oZIZZ8jRVxaNzjQ0IqdQflo2OpJlIc2JOUio7DBaclj2P IrcRGxpNNdnZmIe1OZUVpCW0+csNhVy5tOsQapz6n0CHd8vKC7Sa2HMDjp3BNgifd1PY rfu4daEqQchD5kPOcTmWkIfjzQBe7tcZ0GlWdMBn0SDdgVDqsNw4e1DmefRShRif4eP9 ZVVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763497407; x=1764102207; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IkTX2+CU8bWpu3V0xY0iFG4EWxCDjYf1Ak/ahWcH58o=; b=HNR5ANzuRPNx68DX/chIwSFrINdIVmqyqAJRyOnk2gahCMogSG4X50kkxb48mS9roO awd4XbWTgOtXCTBy3faWCINzqF3gc5JnPZEBb4d+C0L/qyHQl8d8AxbcoItnJz9aLgQ5 NDrRTJhOrtfeJ9BqrgqKM3+NQQCT7u4Egt9OmdFgDkfhywUPGbjW5blVrqMAGX00x9sX EeJGOEeMPWFMfpypDUjy+eMZ2x9U2NVuSColxj95UCTO+C0RLLT2BUsCxEEmdDMRgHgk fE6TU46TqBn4JeB/D7EY9TskNA7sHd2Vk5U53qfgtIaUW0yg3eJNtmompzytXI1TJzXo xVtw== X-Gm-Message-State: AOJu0YzOHyrKhkmViyHmh/BinId4F5FL96+Lb9s0znlnPZdnSHiNi16d kaIpQUtpyZEku8tzsbrkuCMNnRx65BZFi+Mo0IMrlMKmUmWFhHTBN3lN6RhVzBcSlJCWCsJcd3J 6GQn+vyfKtG/HQHRoKs4jqj355BS7tZmpnoGqcxPrkA== X-Gm-Gg: ASbGncs7XROtTvwcMG6l2M00zbzsxmwKgjMRSbwr+cId6W+070KO8h62OwXyYn8+KZ2 aM3IvOyVSKVFv5QuctfTaBo1vMQVxcBYB/DjGyOsixkvb0tdMSPQytna5p1AbQxS9MVLM1ldwoB 0TKEIOIl2zDhUoYnBo2qEGaU574EBYKKRbeF7Y8jOsFZW9q9t445OamNe0fujQYwsdjAz8+nzfP sUdPVVSolGXKcW4leF3g6wQAo4O/4fwbHmUYaSci1U/deN6UVMCNMkaHYgvFRiWVH1Kxdk= X-Google-Smtp-Source: AGHT+IFNr5bRUuc9YQaUNTZ7xvYafzGvf6luXTVe1rO5Jn9qpPsNJf7nkecTG/bF3FwqWauqmSei2JRZdg07KJIfcpQ= X-Received: by 2002:a05:6102:2924:b0:5d7:dec5:b6a7 with SMTP id ada2fe7eead31-5dfc54fee8emr5436087137.7.1763497406639; Tue, 18 Nov 2025 12:23:26 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Marc Millas Date: Tue, 18 Nov 2025 21:23:18 +0100 X-Gm-Features: AWmQ_bl3XXifcpD7bFJBjzyK3vRWcJUY4KrFrefuvRoL7x2AyI1_Nq_nQ4B7xqs Message-ID: Subject: Re: postgres in swap space To: Laurenz Albe Cc: "pgsql-general@lists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000007c3bad0643e43c21" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000007c3bad0643e43c21 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Clear ! thanks Laurentz Marc MILLAS Senior Architect +33607850334 www.mokadb.com On Mon, Nov 17, 2025 at 9:50=E2=80=AFPM Laurenz Albe wrote: > On Mon, 2025-11-17 at 18:25 +0100, Marc Millas wrote: > > Can someone point me to any doc describing why and how much space > postgres uses on the swap of a debian machine ? > > it's an old postgres 10, because it is used by a product for which only > this version is certified. > > (no comment on that, please) > > I'm biting down a comment. > > PostgreSQL itself doesn't use any swap space. > > The kernel can decide to swap out memory used by PostgreSQL. How much > that is depends > on how you configured the Linux kernel and how much memory PostgreSQL > uses. The latter > is mostly determined by "shared_buffers", "work_mem", > "maintenance_work_mem" and > "max_connections". > > On the kernel side, it is mostly the "vm.swappiness" parameter that > determines how > eager the kernel is to swap out memory, even if there is no pressure. Fo= r > best > performance, that should happen as little as possible, and the database > should > determine what to keep in memory and what to store on disk. > > One tool you have to prevent shared buffers from being swapped out is to > define enough > Linux hugepages, so that PostgreSQL can allocate shared buffers there. > Linux does not > swap out hugepages. > > You can find the PostgreSQL parameters described in the PostgreSQL > documentation and the > kernel parameters in the kernel documentation. > > Yours, > Laurenz Albe > --0000000000007c3bad0643e43c21 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Clear !
thanks Laurentz

Marc MILLAS
Senior Arch= itect
+33607850334



On Mon, Nov 17, 2025 at 9:50=E2=80=AFPM= Laurenz Albe <laurenz.albe@= cybertec.at> wrote:
On Mon, 2025-11-17 at 18:25 +0100, Marc Millas wrote:
> Can someone point me to any doc describing why and how much=C2=A0space= postgres uses on the swap of a debian machine ?
> it's an old postgres 10, because it is used by a product for which= only this version is certified.
> (no comment on that, please)

I'm biting down a comment.

PostgreSQL itself doesn't use any swap space.

The kernel can decide to swap out memory used by PostgreSQL.=C2=A0 How much= that is depends
on how you configured the Linux kernel and how much memory PostgreSQL uses.= =C2=A0 The latter
is mostly determined by "shared_buffers", "work_mem", &= quot;maintenance_work_mem" and
"max_connections".

On the kernel side, it is mostly the "vm.swappiness" parameter th= at determines how
eager the kernel is to swap out memory, even if there is no pressure.=C2=A0= For best
performance, that should happen as little as possible, and the database sho= uld
determine what to keep in memory and what to store on disk.

One tool you have to prevent shared buffers from being swapped out is to de= fine enough
Linux hugepages, so that PostgreSQL can allocate shared buffers there.=C2= =A0 Linux does not
swap out hugepages.

You can find the PostgreSQL parameters described in the PostgreSQL document= ation and the
kernel parameters in the kernel documentation.

Yours,
Laurenz Albe
--0000000000007c3bad0643e43c21--