Speed up CREATE DATABASE by deferring the fsyncs until after copying

Greg Stark <stark@mit.edu>

Commit: f8c183a1ac02aef14832c1f29946ef2bcb5866b7
Author: Greg Stark <stark@mit.edu>
Date: 2010-02-15T00:50:57Z
Releases: 9.0.0
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.

Files

PathChange+/−
src/backend/storage/file/fd.c modified +17 −1
src/include/storage/fd.h modified +2 −1
src/port/copydir.c modified +57 −27