pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedQuestion about unlogged to logged conversion
3+ messages / 3 participants
[nested] [flat]
* Question about unlogged to logged conversion
@ 2018-12-27 22:23 Bhavin Gandhi <gb200622@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Bhavin Gandhi @ 2018-12-27 22:23 UTC (permalink / raw)
To: pgsql-general
Hello,
I'm trying to understand for a given unlogged table of a specific size and
# of rows, if I do "alter table" on it to convert it to logged table, is
there a performance difference between 9.5, 9.6 and 10? in other words are
there specific improvements in this area that may not be available in all
Postgres versions?
Also, at a high level, what happens when the table is converted from
Unlogged to logged? Is the operation time dependent on size and number of
rows?
Thanks.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Question about unlogged to logged conversion
@ 2018-12-27 22:52 Ravi Krishna <srkrishna@fastmail.com>
parent: Bhavin Gandhi <gb200622@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Ravi Krishna @ 2018-12-27 22:52 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On Thu, Dec 27, 2018, at 5:23 PM, Bhavin Gandhi wrote:
> Hello,
> I'm trying to understand for a given unlogged table of a specific size
> and # of rows, if I do "alter table" on it to convert it to logged
> table, is there a performance difference between 9.5, 9.6 and 10? in
> other words are there specific improvements in this area that may not
> be available in all Postgres versions?>
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Question about unlogged to logged conversion
@ 2018-12-27 23:02 Michael Paquier <michael@paquier.xyz>
parent: Ravi Krishna <srkrishna@fastmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Michael Paquier @ 2018-12-27 23:02 UTC (permalink / raw)
To: Ravi Krishna <srkrishna@fastmail.com>; +Cc: pgsql-general@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2018-12-27 23:02 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-12-27 22:23 Question about unlogged to logged conversion Bhavin Gandhi <gb200622@gmail.com>
2018-12-27 22:52 ` Ravi Krishna <srkrishna@fastmail.com>
2018-12-27 23:02 ` Michael Paquier <michael@paquier.xyz>
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