What is the use case for UNLOGGED tables

From: Ravi Krishna <sravikrishna(at)aol(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: What is the use case for UNLOGGED tables
Date: 2018-08-14 14:27:49
Message-ID: 82B303ED-33E3-4424-BC27-4B0544A229B6@aol.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am trying to understand the use case for UNLOGGED tables in PG. I am specifically talking about normal tables which need to be turned into UNLOGGED for a specific purpose like bulk loading because generating WAL logs during the load makes no sense, even when we take into consideration that this generally breaks replication.
Typically work flow is:

1. Turn off logging on the table.
2. Load a large set of data using some bulk load tool.
3. Turn back logging.

Depending on RDBMS, some make (3) less painful and some make it painful by rebuilding all indexes. DB2 is very good in that as the only
penalty you have is in step (2) when the table is locked exclusively.

With PG step (3) basically rebuilds entire table. Imagine a 500 million row table, which got additional 30 million rows via a batch load. Does PG
rebuild entire 530 million rows ? Then what exactly is the benefit of UNLOGGED tables, unless we have permanent unlogged tables for disposable
data.

thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-08-14 14:32:12 Re: What is the use case for UNLOGGED tables
Previous Message David G. Johnston 2018-08-14 14:25:08 Re: Copying data from a CSV file into a table dynamically