Re: postgres in swap space

From: Marc Millas <marc(dot)millas(at)mokadb(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: postgres in swap space
Date: 2025-11-18 20:23:18
Message-ID: CADX_1aah__ktrnw-yT5ADp6ppxVpz=r6_ZHLQ0cmM=ZgfOMzZg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Clear !
thanks Laurentz

Marc MILLAS
Senior Architect
+33607850334
www.mokadb.com

On Mon, Nov 17, 2025 at 9:50 PM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)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 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. For
> 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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bernice Southey 2025-11-19 19:20:26 Re: Is this expected concurrency behaviour for EvalPlanQual and ctid?
Previous Message Colin 't Hart 2025-11-18 15:55:06 Re: Using pgAudit to audit interesting tables for all users except for batch user?