Re: Question about unlogged to logged conversion

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Ravi Krishna <srkrishna(at)fastmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Question about unlogged to logged conversion
Date: 2018-12-27 23:02:40
Message-ID: 20181227230240.GC2196@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Dec 27, 2018 at 05:52:14PM -0500, Ravi Krishna wrote:
> Unlogged tables are not stored in the catalog like a regular table. When
> it is converted to a logged table , the entire operation is logged (goes
> into wal logs) in one single transaction, blocking the entire table
> during the process. IMO this makes unlogged -> logged workflow not a
> right fit for large tables.  In other products I have used, large tables
> are set to unlogged mode before bulk load and then set back to normal
> logged mode.

If you are interested of how things happen at code level, you can grep
for INIT_FORKNUM, which is the initial state of an unlogged table used
when doing crash recovery. And while the main fork's data is never
WAL-logged, this initial fork needs to be included in WAL.
--
Michael

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Igor Korot 2018-12-28 10:01:04 libpq bug?
Previous Message Ravi Krishna 2018-12-27 22:52:14 Re: Question about unlogged to logged conversion