OSDN Git Service

Speed up CREATE DATABASE by deferring the fsyncs until after copying
authorGreg Stark <stark@mit.edu>
Mon, 15 Feb 2010 00:50:57 +0000 (00:50 +0000)
committerGreg Stark <stark@mit.edu>
Mon, 15 Feb 2010 00:50:57 +0000 (00:50 +0000)
commitf8c183a1ac02aef14832c1f29946ef2bcb5866b7
treefcbeac8862b585b58786fead156a43022d015224
parente26c539e9f326ea843c0ed005af093b56b55cd4d
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.
src/backend/storage/file/fd.c
src/include/storage/fd.h
src/port/copydir.c