Re: journaled FS and and WAL

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "t(dot)dalpozzo(at)gmail(dot)com" <t(dot)dalpozzo(at)gmail(dot)com>
Cc: pgus-general(at)postgresql(dot)org
Subject: Re: journaled FS and and WAL
Date: 2016-10-19 17:47:20
Message-ID: 20161019174720.GB1607@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgus-general

On Fri, Oct 14, 2016 at 01:22:55PM +0200, t(dot)dalpozzo(at)gmail(dot)com wrote:
> Hi,
> two question related to the WAL.
>
> 1) I read in the doc that journaled FS is not important as WAL is journaling
> itself. But who garantees that the WAL is written correctly? I know that
> it's sequential and a partial update of WAL can be discarded after a
> restart. But am I sure that without a journaled FS, if there is a crash
> during the WAL update, nothing already updated in the WAL before my commit
> can get corrupted?

We fsync the WAL so we don't need the file system to also log it. The
big win for turning off journaling is for non-WAL files, which are
already logged by WAL.

> 2) Let's suppose that I have one database, one table of 100000 rows, each
> 256 bytes. Now, in a single SQL commit, I update row 10, row 30000 and row
> 80000. How much should I expect the WAL increase by? (supposing no WAL
> segments will be deleted). I could guess 8192x3 but I'm not sure

Probably accurate, though we only WAL log the new rows, not the entire
page, except if it is the first page modification after a checkpoint, so
it gets complicated.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to

Browse pgus-general by date

  From Date Subject
Next Message Prashanth Reddy 2017-07-18 01:27:22 Steps to place standby database in read write
Previous Message t.dalpozzo@gmail.com 2016-10-14 11:22:55 journaled FS and and WAL