From: Michael Paquier <michael@paquier.xyz>
To: Ravi Krishna <srkrishna@fastmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Question about unlogged to logged conversion
Date: Fri, 28 Dec 2018 08:02:40 +0900
Message-ID: <20181227230240.GC2196@paquier.xyz> (raw)
In-Reply-To: <1545951134.1308620.1619555704.45725FCC@webmail.messagingengine.com>
References: <CAPRu3+kryziCtrOt9Vv+xu=BTu6xhebAZVoX00LTpQ5Y8k25MQ@mail.gmail.com>
<1545951134.1308620.1619555704.45725FCC@webmail.messagingengine.com>
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
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: michael@paquier.xyz, srkrishna@fastmail.com
Subject: Re: Question about unlogged to logged conversion
In-Reply-To: <20181227230240.GC2196@paquier.xyz>
References: <CAPRu3+kryziCtrOt9Vv+xu=BTu6xhebAZVoX00LTpQ5Y8k25MQ@mail.gmail.com> <1545951134.1308620.1619555704.45725FCC@webmail.messagingengine.com> <20181227230240.GC2196@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox