Speed up CREATE DATABASE by deferring the fsyncs until after copying
Greg Stark <stark@mit.edu>
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
| Path | Change | +/− |
|---|---|---|
| src/backend/storage/file/fd.c | modified | +17 −1 |
| src/include/storage/fd.h | modified | +2 −1 |
| src/port/copydir.c | modified | +57 −27 |