Re: Implement UNLOGGED clause for COPY FROM - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Implement UNLOGGED clause for COPY FROM
Date
Msg-id 2056330.1594389660@sss.pgh.pa.us
Whole thread Raw
In response to RE: Implement UNLOGGED clause for COPY FROM  ("osumi.takamichi@fujitsu.com" <osumi.takamichi@fujitsu.com>)
Responses RE: Implement UNLOGGED clause for COPY FROM  ("osumi.takamichi@fujitsu.com" <osumi.takamichi@fujitsu.com>)
List pgsql-hackers
"osumi.takamichi@fujitsu.com" <osumi.takamichi@fujitsu.com> writes:
>> Aside from that, though, how does this improve upon the existing capability to copy into an unlogged temporary
table?

> [>] unlogged temporary table can’t be inherited over sessions first of all.

Unlogged tables don't have to be temporary.

> And unlogged table needs to be recreated due to startup truncation of the table’s content
> when the server crashes.

Indeed, and your proposed feature would extend that un-safety to tables
that are NOT marked unlogged, which is not good.

AFAICS, we can already accomplish basically the same thing as what you
want to do like this:

alter table foo set unlogged;
copy foo from ...;
alter table foo set logged;

The mechanics of that are already well worked out.  It's expensive,
no doubt about that, but I think you're just fooling yourself to
imagine that any shortcuts are possible.  A mix of unlogged and logged
data is never going to work safely.

> To achieve this, we have to
> consider a new idea like loaded data’d be added
> at the end of the all other pages and detach those
> if the server crashes during the UNLOGGED loading processing for example.

You keep on ignoring the indexes... not to mention replication.

            regards, tom lane



pgsql-hackers by date:

Previous
From: "osumi.takamichi@fujitsu.com"
Date:
Subject: RE: Implement UNLOGGED clause for COPY FROM
Next
From: Tom Lane
Date:
Subject: Re: distribute_restrictinfo_to_rels if restrictinfo contains volatile functions