From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ron <ronljohnsonjr@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Temporary tablespaces on a RAM disk
Date: Tue, 17 Mar 2020 15:22:07 -0400
Message-ID: <18467.1584472927@sss.pgh.pa.us> (raw)
In-Reply-To: <427c0a2d-77aa-d931-3738-0128a069c2df@gmail.com>
References: <ZR0P278MB0028A89FAA3E31E7F1514EF6D2F60@ZR0P278MB0028.CHEP278.PROD.OUTLOOK.COM>
<CAKFQuwb4FGHNHT33W0+86ZXJB2y+9Gfj0anj6Fw-VgxudeyBig@mail.gmail.com>
<427c0a2d-77aa-d931-3738-0128a069c2df@gmail.com>
Ron <ronljohnsonjr@gmail.com> writes:
> On 3/17/20 12:19 PM, David G. Johnston wrote:
>> There is a nice big bold warning callout in the documentation that covers
>> this explicitly.
>> https://www.postgresql.org/docs/12/manage-ag-tablespaces.html>>> Warning
>>> Placing a tablespace on a temporary file system like a RAM disk risks the
>>> reliability of the entire cluster.
> But aren't temporary files removed when you restart Postgres? (I'm assuming
> that temp_tablespaces is treated "the same" as data/pgsql_tmp. Is that a
> false assumption?)
I think the main issue is that there's no mechanism preventing you from
putting regular (non-temp) tables into the "temporary" tablespace.
If you do, crash recovery will get very unhappy when it tries to replay
updates for those tables and they're not there.
There are probably additional issues having to do with the tablespace
directory(s) disappearing. That, you could maybe finesse by having the
postmaster start script re-create any missing directories.
All in all, I wouldn't try it without careful pre-testing of what happens
after the RAM disk gets wiped.
People have asked about this before, so maybe it'd be an idea to make
an explicit concept of a temp tablespace that only accepts temp tables,
and do whatever is needful to make that robust. But I've not heard of
any work towards that.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, ronljohnsonjr@gmail.com
Subject: Re: Temporary tablespaces on a RAM disk
In-Reply-To: <18467.1584472927@sss.pgh.pa.us>
References: <ZR0P278MB0028A89FAA3E31E7F1514EF6D2F60@ZR0P278MB0028.CHEP278.PROD.OUTLOOK.COM> <CAKFQuwb4FGHNHT33W0+86ZXJB2y+9Gfj0anj6Fw-VgxudeyBig@mail.gmail.com> <427c0a2d-77aa-d931-3738-0128a069c2df@gmail.com> <18467.1584472927@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox