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 1uaF1I-002EOX-1m for pgsql-general@arkaria.postgresql.org; Fri, 11 Jul 2025 14:46:36 +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 1uaF1G-005ONW-16 for pgsql-general@arkaria.postgresql.org; Fri, 11 Jul 2025 14:46:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uaF1F-005OMZ-IV for pgsql-general@lists.postgresql.org; Fri, 11 Jul 2025 14:46:34 +0000 Received: from mout.gmx.net ([212.227.17.20]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uaF1D-0072ci-17 for pgsql-general@lists.postgresql.org; Fri, 11 Jul 2025 14:46:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1752245185; x=1752849985; i=jimis@gmx.net; bh=wqDvWP8ZSrNXFm2uJztJeNz15fN7vDgtfAmBW3sE7RA=; h=X-UI-Sender-Class:Date:From:To:cc:Subject:In-Reply-To:Message-ID: References:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=hCpLmNz4gh6wvNJ/dpxmtN52vC6VXwm+c4L+Or8fp45MZC0kzydnJpMjyyk8SoCb 5XgYvk2VrvpmAonYdkJI/Wu3Yrnhn6kaP3vI15ZXq1HIPPcyYEMtFQ+2jJpy4zPSi nRQH8XT251qEwuWD7aiBa7SOzQ6SeSwRmZuR83uQBEsYpJX6fd4iX4tuBPKqedq2k LX3yef/4cUjEUqEvAGMkDN5jlT0Pf1PHH3CqyU9mak+oCDA/PCK7Djr9bgrhRV8Ap rZtsB0funiaQcGY/PHJ9VnnFU8SS6exq6i2RJvPwPkVIbYd4nykI2xCyeNmfnMkIb g8b2Qhp7AAOgC7nbKg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [10.9.70.81] ([185.55.106.54]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MsHru-1uunm63gsc-00zliR; Fri, 11 Jul 2025 16:46:24 +0200 Date: Fri, 11 Jul 2025 16:46:19 +0200 (CEST) From: Dimitrios Apostolou To: pgsql-general@lists.postgresql.org cc: david.g.johnston@gmail.com, daniel.westermann@dbi-services.com, tgl@sss.pgh.pa.us Subject: Re: having temp_tablespaces on less reliable storage In-Reply-To: <1de78bf7-940a-9be5-e98d-a11f02d9e898@gmx.net> Message-ID: References: <1de78bf7-940a-9be5-e98d-a11f02d9e898@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Provags-ID: V03:K1:8KmpEyrSM8vOlqx03ijbox9iMGiS7rZeTqQDLbpeyNi2jg36LOT oenqovNszZmKUJUWr1i8TyQsXRGxcsEKJbp4yuZRGngP8boBfmtmG0hw1+LoG3/pyxAdJz2 sljlKlVl09cwj4AOMv5V/rMGI+oDSXHWwJfIPk4ZpGbiLPKkQgZQJ/EOa0DX864H2Z7teF7 J+Dgh29JvCmdixwoCxzXg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:1eGp31FmTZw=;cY+DO5GMe6xkDqOpZHUmnOg77xc jVf+4SzRYTAE6rgpYUCj284SacYp42oAreKHPZILW7kuu58QHQ4BcX1FXwqGdDLCfFzcBj/+F Z76cwxflhTF7C+geMr1P6lmydAJOyMPPKxNTwAeqQp1ADx1VVZoNfl1+2iXo/5GSIwjjQ3ELY Eucs8+2vFzp5ehVbBmvIMMqWg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SBdmJXJ+B1d5/MTO2dARpxhOl75tCz2 KhC/x/J2X1I+ZZzr2sTyPlmuKQSJOwI/TC7uJvKCL3fiVe39w/TScve+90+boWExPQk3XTr5L ZgjQ6Ae+FdOnfgsLhuMPKQIg3xVQ2xjavjUMDQpdcSUZvkxlwH9C5hOWLKdDJYo+CGYozBlv0 AQ== Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 10 Jul 2025, Dimitrios Apostolou wrote: > Hello list, > > I have a database split across many tablespaces, with temp_tablespaces= =20 > pointing to a separate, less reliable device (single local NVMe drive). = How=20 > dangerous is it for the cluster to be unrecoverable after a crash? > > If the drive goes down and the database can't read/write to temp_tablesp= aces,=20 > what will happen? > > If I then configure temp_tablespaces to point to a working location, wou= ld=20 > that be enough to start the cluster? Or other bad things can happen? > > Can't find any related documentation, but I expect loss of "temp" space = is of=20 > minor importance. David G. Johnston wrote: > > You might want to try finding some old discussions about why putting tem= p > tablespace on a RAM-drive is not a supported configuration. Thank you, I found the following: [1] https://www.postgresql.org/docs/current/manage-ag-tablespaces.html [2] https://www.postgresql.org/message-id/flat/ZR0P278MB0028A89FAA3E31E7F1= 514EF6D2F60%40ZR0P278MB0028.CHEP278.PROD.OUTLOOK.COM [3] https://www.dbi-services.com/blog/can-i-put-my-temporary-tablespaces-o= n-a-ram-disk-with-postgresql/ At [1] is the standard documentation warning about tablespaces in general:= =20 "if you lose a tablespace (file deletion, disk failure, etc.), the=20 database cluster might become unreadable or unable to start". I believe this could be improved, especially with regards to=20 temp_tablespaces. At [2] is a thread started by Daniel Westermann (CC'd) with lots of=20 uncertainty in the air. Tom Lane (CC'd) mentions that as long as files are= =20 temporary (not supposed to be there after restart), it should be fine, but= =20 there might be additional issues with the directory disappearing after a= =20 restart. At [3] is a blog from Daniel who started the previous thread. He removes= =20 directories and restarts the cluster and things go OK. I'm leaning towards doing it, i.e. creating a tablespace on the super-fast= =20 local SSD and using it exclusively for temp_tablespaces. The queries my=20 database is facing are crunching TBs of data for many hours and write tons= =20 of temporary data, and the local NVMe storage is a huge improvement over= =20 the enterprise-storage volumes the VM is provided with (I believe they are= =20 iSCSI based underneath, bound to network latency). What if the NVMe drive fails? The good scenario is that I will create a new tablespace at a new location= =20 and change temp_tablespaces to point there, and everything should be fine.= =20 Possibly without even a cluster restart. The very bad scenario is that the cluster will crash and will need=20 restart, but that will go sideways and will eventually need restore from= =20 backup or other hacks. How possible would that be? Thanks, Dimitris