Re: Orphaned relations after crash/sigkill during CREATE TABLE

Поиск
Список
Период
Сортировка
От Jason Myers
Тема Re: Orphaned relations after crash/sigkill during CREATE TABLE
Дата
Msg-id CAFzLwcxNDDn+ipy4cDdJ7zvkPh_ceQ+Sd===93K-aOryKvuzdA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Orphaned relations after crash/sigkill during CREATE TABLE  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Orphaned relations after crash/sigkill during CREATE TABLE  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: Orphaned relations after crash/sigkill during CREATE TABLE  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general

On Tue, Aug 18, 2020 at 3:49 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
> So from [1] you are using CREATE TABLE AS. 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. Have not tested but I'm going to assume
> if you kill the above the problem would not happen or would be fixable
> by DELETE FROM some_table/TRUNCATE some_table;

I was able to implement this, which creates the table quickly in a first transaction and populates it in a second transaction.

However we were still seeing orphaned files on crash, and I believe I tracked it down to subsequent CREATE INDEX statements also creating these orphaned files (if they are running during a crash).

Is that issue known as well?  I don't believe I can use the same trick to sidestep that one...

-Jason

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Misestimate when applying condition like id = id
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Orphaned relations after crash/sigkill during CREATE TABLE