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

From osumi.takamichi@fujitsu.com
Subject Implement UNLOGGED clause for COPY FROM
Date
Msg-id OSBPR01MB488887C0BDC5129C65DFC5E5ED640@OSBPR01MB4888.jpnprd01.prod.outlook.com
Whole thread Raw
Responses Re: Implement UNLOGGED clause for COPY FROM  (Fujii Masao <masao.fujii@oss.nttdata.com>)
Re: Implement UNLOGGED clause for COPY FROM  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers
Hello, hackers.


I've been thinking to suggest
a peformance-oriented feature for COPY FROM.
It's UNLOGGED clause, which means data loading skipping WAL generation.

How to make it work is the following.
1. Aquire ACCESS EXCLUSIVE mode to lock the target table and its indexes.
2. Mark those relations 'unrecoverable' in pg_class/pg_index.
3. Issue one WAL to indicate when COPY UNLOGGED is executed.
4. Execute the data loading, bypassing WAL generation for data.
5. Sync the data to disk by performing checkpoint.

During the recovery,
I'd like to make postgres recognize both marked 'unrecoverable' flags of the second step
and when the command was issued by the third step
in order to recover data that the target table had before the execution of COPY UNLOGGED.

Oracle's SQL*Loader has
such a feature called UNRECOVERABLE to boost the loading speed
for severe time limit of workload.


Best,
    Takamichi Osumi



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Next
From: Tom Lane
Date:
Subject: Re: Is this a bug in pg_current_logfile() on Windows?