Re: Prepare Transaction support for ON COMMIT DROP temporary tables

From: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Dimitri Fontaine <dimitri(at)citusdata(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Prepare Transaction support for ON COMMIT DROP temporary tables
Date: 2019-01-18 09:50:29
Message-ID: 4a32d8f7-640d-fd96-5f80-f716d2eaf9af@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16/01/2019 17:44, Robert Haas wrote:
> On Mon, Jan 14, 2019 at 1:41 PM Dimitri Fontaine <dimitri(at)citusdata(dot)com> wrote:
>> One idea would be that if every temp table in the session belongs to the
>> transaction, and their namespace too (we could check through pg_depend
>> that the namespace doesn't contain anything else beside the
>> transaction's tables), then we could dispose of the temp schema and
>> on-commit-drop tables at PREPARE COMMIT time.
>
> Why not just drop any on-commit-drop tables at PREPARE TRANSACTION
> time and leave the schema alone? If there are any temp tables touched
> by the transaction which are not on-commit-drop then we'd have to
> fail, but as long as all the tables we've got are on-commit-drop then
> it seems fine to just nuke them at PREPARE time. Such tables must've
> been created in the current transaction, because otherwise the
> creating transaction aborted and they're gone for that reason, or it
> committed and they're gone because they're on-commit-drop. And
> regardless of whether the transaction we are preparing goes on to
> commit or abort, those tables will be gone afterwards for the same
> reasons. So there doesn't in this case seem to be any reason to keep
> them around until the transaction's fate is known.

Isn't that what happens already? PrepareTransaction() calls
PreCommit_on_commit_actions() from what I can tell.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2019-01-18 10:03:29 Re: Ryu floating point output patch
Previous Message Amit Langote 2019-01-18 08:50:56 Re: using expression syntax for partition bounds