Re: Any difference between commit/rollback when only temp tables and \copy are used

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Any difference between commit/rollback when only temp tables and \copy are used
Date: 2016-05-16 22:00:12
Message-ID: CAKFQuwbgDzerfGXVE-1N5YHC-30p8-HqnPyaWw5T2_SgY=eZ7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, May 16, 2016 at 4:08 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 05/16/2016 12:41 PM, David G. Johnston wrote:
>
>> I have a psql script that obtains data via the \copy command and loads
>> it into a temporary table. Additional work is performed possibly
>> generating additional temporary tables but never any "real" tables.
>> Then the script outputs, either to stdout or via \copy, the results.
>>
>> Does it matter whether I issue a ROLLBACK or a COMMIT at the of the
>> transaction? More basically: does it matter whether I issue a BEGIN?
>>
>
> I would say that depends on how you are creating the temp table:
>
>
​I'm presently using them without an "ON COMMIT" clause - they live until
the end of the script/session/transaction (which here are all the same).

So within-transaction storage usage would be controllable ​making the use
of BEGIN at least potentially meaningful - as long rollbacks or commits are
used and more than one transaction is used to isolate the different parts.

The lack of auto-analyze is something to keep in mind (but haven't been bit
by it yet so getting it to stick in memory is more difficult) in either
case...though present usage involves sequential scans anyway.

Thanks!

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Moynes 2016-05-16 22:33:09 WAL files not being recycled
Previous Message Adrian Klaver 2016-05-16 21:48:34 Re: Connections - Postgres 9.2