Re: initdb and fsync - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: initdb and fsync
Date
Msg-id 1331698983.6425.108.camel@jdavis
Whole thread Raw
In response to Re: initdb and fsync  (Andres Freund <andres@anarazel.de>)
Responses Re: initdb and fsync
List 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

pgsql-hackers by date:

Previous
From: Euler Taveira
Date:
Subject: Re: pg_upgrade and statistics
Next
From: Joachim Wieland
Date:
Subject: Re: patch for parallel pg_dump