Re: Orphaned relations after crash/sigkill during CREATE TABLE

From: Jason Myers <j(dot)myers(at)brstrat(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Orphaned relations after crash/sigkill during CREATE TABLE
Date: 2020-08-18 20:19:24
Message-ID: CAFzLwcxDiNvffDLDRc2Mh3js+ub76QZLyAei6QWEr7Hv8p4O-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Tue, Aug 18, 2020 at 3:49 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> > Have you tried with:
> BEGIN;
> CREATE TABLE some_table SELECT some_data FROM other_table LIMIT 1 WITH
> NO DATA;
> COMMIT;
>
> The above gets you the table structure, but no data.
>
> BEGIN;
> INSERT into some_table SELECT * FROM other_table;
>COMMIT;
>
> The above populates the table

Thanks -- we were indeed creating and populating the new table all in a
single transaction.

I'll see if we can split this into two transactions so that the table
structure is committed quickly. I think you're right that this would
mostly sidestep the issue.

-Jason

p.s. Apologies if this is formatted wrong, this is my first mailing list
post.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthias van de Meent 2020-08-18 20:31:15 Re: Index tuple deduplication limitations in pg13
Previous Message Peter Geoghegan 2020-08-18 20:00:25 Re: Index tuple deduplication limitations in pg13