Re: initdb and fsync

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Noah Misch <noah(at)leadboat(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: initdb and fsync
Date: 2012-03-14 04:23:03
Message-ID: 1331698983.6425.108.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2012-03-13 at 09:42 +0100, Andres Freund wrote:
> for recursively everything in dir:
> posix_fadvise(fd, POSIX_FADV_DONTNEED);
>
> for recursively everything in dir:
> fsync(fd);

Wow, that made a huge difference!

no sync: ~ 1.0s
sync: ~10.0s
fadvise+sync: ~ 1.3s

Patch attached.

Now I feel much better about it. Most people will either have fadvise, a
write cache (rightly or wrongly), or actually need the sync. Those that
have none of those can use -N.

Regards,
Jeff Davis

Attachment Content-Type Size
initdb-fsync-20120313.patch.gz application/x-gzip 2.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joachim Wieland 2012-03-14 04:34:10 Re: patch for parallel pg_dump
Previous Message Euler Taveira 2012-03-14 04:03:26 Re: pg_upgrade and statistics