pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after

From: stark(at)postgresql(dot)org (Greg Stark)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after
Date: 2010-02-15 00:50:57
Message-ID: 20100215005057.5AC8F7541C5@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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.

Modified Files:
--------------
pgsql/src/backend/storage/file:
fd.c (r1.153 -> r1.154)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/file/fd.c?r1=1.153&r2=1.154)
pgsql/src/include/storage:
fd.h (r1.66 -> r1.67)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/fd.h?r1=1.66&r2=1.67)
pgsql/src/port:
copydir.c (r1.25 -> r1.26)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/port/copydir.c?r1=1.25&r2=1.26)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message User Itagaki 2010-02-15 01:38:06 reorg - pg_reorg: version 1.0.8.
Previous Message Robert Haas 2010-02-14 18:42:19 pgsql: Wrap calls to SearchSysCache and related functions using macros.

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2010-02-15 01:25:25 Explain buffers display units.
Previous Message Mark Mielke 2010-02-15 00:08:10 Re: Re: Faster CREATE DATABASE by delaying fsync