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 1u2pwK-006eGW-Ly for pgsql-general@arkaria.postgresql.org; Thu, 10 Apr 2025 11:19:24 +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 1u2pwJ-00AbOx-2z for pgsql-general@arkaria.postgresql.org; Thu, 10 Apr 2025 11:19:23 +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 1u2pwI-00AbOp-Ke for pgsql-general@lists.postgresql.org; Thu, 10 Apr 2025 11:19:23 +0000 Received: from mout.gmx.net ([212.227.17.22]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u2pwH-0042tC-02 for pgsql-general@lists.postgresql.org; Thu, 10 Apr 2025 11:19:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1744283958; x=1744888758; i=jimis@gmx.net; bh=jMMOmCtJLML5UOuRhN/9GDYGNz4bpnws0tqNpPr8KQQ=; h=X-UI-Sender-Class:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=nUmOeLa+sCSizBOhd0NrRTrPnPOd8i6Df8GUVFD6mmz0XaFsPYttPSal6HuwSPHq vdyxJZ1Ny2yhkFpT/K+cCGrKGm5bpCVa6t4Sbgz94aP7F36ecrAavqUXvPHexdUCX mpE9xuyGflgqXZAeBFLXWWAjLC83aoQAmqj1wSek8oz8Hrh2FqDfvg7O0flqPtiaZ 1Mby10YLVTDWwYbZ0X+8Ii+XJoY8AbBClfWvPN2iSwKYR+cleHknygiLQjwfEei1p cluFdVGEgt5bvSZwxzh+GJXT/H5RApBFZQcSmOxbdHAZ7BZeRqd9Yd/fkt36QQ8iL r0hpzqdtSepJYSNk5w== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from qtjimis-OpenSUSE-2.lan ([84.215.109.181]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MWici-1taHWQ29gu-00XDep for ; Thu, 10 Apr 2025 13:19:18 +0200 Date: Thu, 10 Apr 2025 13:19:17 +0200 (CEST) From: Dimitrios Apostolou To: pgsql-general@lists.postgresql.org Subject: pg_restore causing ENOSPACE on the WAL partition Message-ID: <076464ad-3d70-dd25-9e8f-e84f27decfba@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Provags-ID: V03:K1:0dJYA97ZdpBCqCGtMfglj8ydo0PrsDhmpey6zj2XH7esvDFJXaK CRwGq4iqogg8PeP/syjkhjIKTSD3vysfO3IU+pAj0GzmGH7C6WnFppPQAY8uvtu/3xZijuN BXEdykucDIV/z9PIjNMejPWPnek+ig8KfSFfjsmhrCRzAHp6cO2EVup5kuL3kD2IyVih57F VzoX3VsUYKZBTBQ6F0YFQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:xSD5B8/NnU4=;C7qzp6gyvndr0A+o0f9U+Q/3j3N 5yIObfU2ejuGgkuQ3vset7gblNZQc06GOIrTYH9CS7CK0VZNDzmCnUf5ZkBC1v0zQ+VpMcipF pgI5R7w1iCnFKNAsPSxBWfV7jhmv86tKhJuPnjRAt3KkYDgb/kjfet3Blx0/l/7BGhH9Turyb 2g7dww002fal10pOeHwAQKm2lCB/JIX/TdaRKu17YKEV2Y0xZq79eAiYc3sMMScpfJ5rJA4WP jLS3Ux8VbIuClFddA+fLSSIDWncZKsJD3TTn9GiGcNpW6pl201hHMa51GQ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q2GzlsewQGO/85/sIi8MtvY 8QvN4AK4FhIjBRjMOqApvg49sWzORuOTEeU/aCWdPhQRpxmUA34M0yaoED9LK5jq3ZOB/AR5H q6Fo6FuP0tMJRtNXrsbsf+Y8QGSg= Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello list, last night I got ENOSPACE on the WAL partition while running a huge pg_restore on an empty and idle database. The checkpoint that started 7 minutes earlier never finished: 04:31:09 LOG: checkpoint starting: wal ... 04:38:04 PANIC: could not write to file "pg_wal/xlogtemp.546204": No s= pace left on device :CONTEXT: COPY table_partition_123, line 120872534 This is most likely because most of the data is written to a very slow "archival" tablespace. No I/O errors on the system logs, I know things go slow on that device (iSCSI drive over a shared spinning-disks pool and busy network). This happened even though I'm keeping the WAL in its own partition (128GB partition size), with a lot of free space above max_wal_size (64GB). Somehow it managed to grow above max_wal_size and fill 100% of the partition. I'm running latest PostgreSQL 17 and the settings have been temporarily tweaked for fastest pg_restore: max_wal_size=3D64GB max_replication_slots =3D 0 max_logical_replication_workers =3D 0 max_wal_senders =3D 0 wal_level =3D minimal autovacuum =3D off Several things seem to have gone wrong here. Questions: + The WAL partition is much faster than the archival tablespace. Am I in constant danger of overruning max_wal_size? How to make 100% sure this never happens again? + After recovery, with the database idling, I notice that WAL space usage is constant at 64GB. Why doesn't it free up space down to min_wal_size = (1GB)? + I just created a 13GB zstd-compressed tarball of those 64GB WAL files. This indicates that the files are compressible despite using wal_compression=3Dzstd setting. Could it be that postgres ignores the f= lag and does not compress the WAL? How to check? + I'm using parallel pg_restore --data-only, can't avoid that for now. Even though all the tables are empty (I truncated everything before starting pg_restore), I can't find a way to avoid going through the WAL= . Ideas? Thanks in advance, Dimitris