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.94.2) (envelope-from ) id 1t7b9N-002kMW-Eh for pgsql-general@arkaria.postgresql.org; Sun, 03 Nov 2024 14:00:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t7b9L-00CMsk-Om for pgsql-general@arkaria.postgresql.org; Sun, 03 Nov 2024 14:00:16 +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.94.2) (envelope-from ) id 1t7b9L-00CMsc-7S for pgsql-general@lists.postgresql.org; Sun, 03 Nov 2024 14:00:15 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t7b9I-004Hi7-Tg for pgsql-general@postgresql.org; Sun, 03 Nov 2024 14:00:14 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5ced377447bso727973a12.1 for ; Sun, 03 Nov 2024 06:00:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730642411; x=1731247211; darn=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=TVJufmYMamf4wpPYRCUKBfpKWrWGvM2FGzKQylinegU=; b=RxynwnNvSXSfSk/sCGOCmgt48Af6jJ+L+ItVNhMuZAxgJLYJouulTizMTXRA1AyPCH oaAgvbc6zTRuJJOYPTqMkPD3qSQqbJiF5KlW1WAnGRJ1Uh2aaY0Yqe3t+hz40vf3Pjiu KqWHFeQQK2K/ItZm1lgT0P4n23WHxkRRlU6qP+9k7UWp5Cy5PvsIMWOpFQCgarePBc7W 1H1zMM4pVzRmx+ZJZN1D6+vavUJyp+F2KvsB1kyvVhEKYQoEboxUxonzWq4yYkxTftXd XepMWrshhFquBzNDn8Qqo4tPihnY1R7syPe0TZJiu3uc4ref0IFlOguoDIm6ABtmFZ4C f+2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730642411; x=1731247211; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TVJufmYMamf4wpPYRCUKBfpKWrWGvM2FGzKQylinegU=; b=s0/521oHekaz900bEd7rzmgiC1TBJudtZZuJoWw2Ju0NFC6MN6RMAhlc8AtvpMWyLY nXnm91cT2UlWK/a8jvY9A9gD5U48x5NSaRGwpHzcCPBYlTf1G/KbPTz0CQyLgRzCVdRk yi2DnPzfvr8SUbbXGCLfGMlap95WKNvcRGUa1pFlQEj84ETM3ZgP7ZyYG2Tz9fSZ0iwH RHc/iYCohpRbsGkwUyCZLzkoMbnYpc1qKZHMK2cSK1QhiHrAJl7Qh3zo9dHZvR0Txw2l bLp5ctbFaFAzpc9gQ4vQ+NXydGPtuVzVEyjcguEFTbk3vpg8IFM64zHqpE6ft3Oe+L4i XEvg== X-Forwarded-Encrypted: i=1; AJvYcCVmjxiVEFJ+4CK5cDegNEySw0/GIPmZTXjoMIGvdoxJEiyHd3OKj68djqLGlvKDjlwvMXLO6gSgy11Yz6Fx@postgresql.org X-Gm-Message-State: AOJu0YxL1ORbYlnLYYnobqX9ZxrSROcgmqiYitIUWRMvsijdi7Uwk/UW zDrHOmkO6UJItZPHsqpOBMLrOclkXF4djbxH0GdD22uUMgut2E1DOYSSe7cc939OyhuxhDxVYcT RftBCeMX4ZmXuWlVqhK/yTxTn+84= X-Google-Smtp-Source: AGHT+IGm1cizO5IhsbJ4fhOKNFFCyZEucpHAnyDLZhYv+/MFni/q+pHjiK9arEdxoQQ12wEZML1AbAuUd4coH7zR+nc= X-Received: by 2002:a17:907:e88:b0:a9a:16b3:7dda with SMTP id a640c23a62f3a-a9e3a5a0e0dmr1625254266b.19.1730642409124; Sun, 03 Nov 2024 06:00:09 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Koen De Groote Date: Sun, 3 Nov 2024 14:59:55 +0100 Message-ID: Subject: Re: pg_wal folder high disk usage To: Greg Sabino Mullane Cc: Muhammad Usman Khan , Paul Brindusa , pgsql-general Content-Type: multipart/alternative; boundary="0000000000000779a7062602967d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000000779a7062602967d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable A possible reason for pg_wal buildup is that there is a sort of replication going on(logical or physical replication) and the receiving side of the replication has stopped somehow. This means: a different server that has a connection to your server and is expecting to receive data. And your server is then expecting to have to send data(this is the important bit). There could be multiple of these connections. If even 1 of these receiving servers is down, or the network is out, or there is some other reason that it is no longer requesting data from your server, your server will notice it isn't getting confirmation from that other side, that they have received the data. As such, your postgres server will keep this data locally, expecting this situation to be solved in the future, and at that point in time, send all the data the other side hasn't gotten yet. This is 1 option. As long as your server is configured to expect that other server to be there, and to be receiving, the buildup will continue. Taking the other server offline won't help, in fact it is likely the cause of the issue. The official documentation explains how to get rid of replication slots, ideally your DBA should handle this. Laurenz's blogpost lays out all the options, for instance it can also happen that your system is generating data so fast, the writing of the WAL files cannot keep up. Or your setup also does WAL archiving and the compression on that is slow. The post offers some ways to verify things, I suggest checking them out. And of course, if your DBA is back, have them look at it too. Regards, Koen De Groote On Fri, Nov 1, 2024 at 2:10=E2=80=AFPM Greg Sabino Mullane wrote: > On Fri, Nov 1, 2024 at 2:40=E2=80=AFAM Muhammad Usman Khan > wrote: > >> For immediate space, move older files from pg_Wal to another storage but >> don't delete them. >> > > No, do not do this! Figure out why WAL is not getting removed by Postgres > and let it do its job once fixed. Please recall the original poster is > trying to figure out what to do because they are not the database admin, = so > having them figure out which WAL are "older" and safe to move is not good > advice. > > Resizing the disk is a better option. Could also see if there are other > large files on that volume that can be removed or moved elsewhere, esp. > large log files. > > Hopefully all of this is moot because their DBA is back from leave. :) > > Cheers, > Greg > > > --0000000000000779a7062602967d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
A possible reason for pg_wal buildup is that there is= a sort of replication going on(logical or physical replication) and the re= ceiving side of the replication has stopped somehow.

This means: a different server that has a connection to your server = and is expecting to receive data. And your server is then expecting to have= to send data(this is the important bit). There could be multiple of these = connections.

If even 1 of these receiving serv= ers is down, or the network is out, or there is some other reason that it i= s no longer requesting data from your server, your server will notice it is= n't getting confirmation from that other side, that they have received = the data. As such, your postgres server will keep this data locally, expect= ing this situation to be solved in the future, and at that point in time, s= end all the data the other side hasn't gotten yet.

This is 1 option. As long as your server is configured to expect t= hat other server to be there, and to be receiving, the buildup will continu= e. Taking the other server offline won't help, in fact it is likely the= cause of the issue. The official documentation explains how to get rid of = replication slots, ideally your DBA should handle this.

<= /div>
Laurenz's blogpost lays out all the options, for instance it can also h= appen that your system is generating data so fast, the writing of the WAL f= iles cannot keep up. Or your setup also does WAL archiving and the compress= ion on that is slow.

The post offers some ways to = verify things, I suggest checking them out.

And of= course, if your DBA is back, have them look at it too.

Regards,
Koen De Groote


<= div class=3D"gmail_quote">
On Fri, Nov= 1, 2024 at 2:10=E2=80=AFPM Greg Sabino Mullane <htamfids@gmail.com> wrote:
On Fri, = Nov 1, 2024 at 2:40=E2=80=AFAM Muhammad Usman Khan <usman.k@bitnine.net> wrote:
For immediate space, move older files from pg_Wal to a= nother storage but don't delete them.

No, do not do this! Figure out why WAL is not getting removed by P= ostgres and let it do its job once fixed. Please recall the original poster= is trying to figure out what to do because=C2=A0they are not the database = admin, so having them figure out which WAL are "older" and safe t= o move is not good advice.

Resizing the disk is a = better option. Could also see if there are other large files on that volume= that can be removed or moved elsewhere, esp. large log files.
Hopefully all of this is moot because their DBA is back from l= eave. :)=C2=A0

Cheers,
Greg

--0000000000000779a7062602967d--