Re: ON COMMIT options for non temporary tables - Mailing list pgsql-general

From Michael Paquier
Subject Re: ON COMMIT options for non temporary tables
Date
Msg-id 20191122072709.GD42684@paquier.xyz
Whole thread Raw
In response to Re: ON COMMIT options for non temporary tables  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-general
On Thu, Nov 21, 2019 at 05:13:31PM +0100, Laurenz Albe wrote:
> How should that work for tables other than temporary tables?
> Should COMMIT lock if somebody else accesses the table?

Postgres does not support read uncommitted, so the table would not be
visible to other sessions until the transaction that created it is
committed.  Anyway, the goal is to use the table just within a
transaction without having it produce WAL, right?

> What keeps you from explicitly dropping the table right before
> you commit?

Yeah, that would be the most simple.  Another idea I can think of here
is to use a combination of event trigger and deferred triggered on a
dummy constraint: register the table creation using the event trigger
on CREATE TABLE, and then drop it using the deferred trigger.  Using a
DROP TABLE before the commit or once your transaction is done with
this table is much more simple of course :)
--
Michael

Attachment

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Adding LIMIT changes PostgreSQL plan from good to a bad one
Next
From: rutuparna andhare
Date:
Subject: Active-Passive DB