Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after - Mailing list pgsql-committers

From Andres Freund
Subject Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after
Date
Msg-id 201002220043.29420.andres@anarazel.de
Whole thread Raw
In response to pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after  (stark@postgresql.org (Greg Stark))
Responses Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after  (Greg Stark <stark@mit.edu>)
Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
On Monday 15 February 2010 01:50:57 Greg Stark wrote:
> Log Message:
> -----------
> Speed up CREATE DATABASE by deferring the fsyncs until after copying
> all the data and using posix_fadvise to nudge the OS into flushing it
> earlier. This also hopefully makes CREATE DATABASE avoid spamming the
> cache.
>
> Tests show a big speedup on Linux at least on some filesystems.
>
> Idea and patch from Andres Freund.
I just found a relatively big problem with one of your modifications on the
patch - you removed the
FreeDir(xldir);
xldir = AllocateDir(fromdir);
pair - unfortunately its crucial because otherwise the DIR does not get
rewound - that resulted in *no* files getting fsync()ed (otherwise the loop
above wouldn't have finished yet...).
I think that was also causing the problems I pointed out in " Directory fsync
and other fun"...

You removed it because you didn't want to open the directory twice? I think
doing that is simpler than using rewinddir - I have no idea how usable that
one is on windows for example

Could you add it back?

Andres

pgsql-committers by date:

Previous
From: adunstan@postgresql.org (Andrew Dunstan)
Date:
Subject: pgsql: Adjust sample auto-explain output to reflect query text
Next
From: stark@postgresql.org (Greg Stark)
Date:
Subject: pgsql: Oops, don't forget to rewind the directory before scanning it to