Re: [HACKERS] Faster CREATE DATABASE by delaying fsync (was 8.4.1 ubuntu karmic slow createdb)

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Greg Stark <gsstark@mit.edu>
Cc: pgsql-hackers@postgresql.org, Greg Smith <greg@2ndquadrant.com>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-performance@postgresql.org, Michael Clemmons <glassresistor@gmail.com>, Hannu Krosing <hannu@2ndquadrant.com>, Scott Marlowe <scott.marlowe@gmail.com>
Date: 2009-12-29T11:13:21Z
Lists: pgsql-hackers, pgsql-performance
On Tuesday 29 December 2009 11:48:10 Greg Stark wrote:
> On Tue, Dec 29, 2009 at 2:05 AM, Andres Freund <andres@anarazel.de> wrote:
> >  Reads Completed:        2,        8KiB  Writes Completed:     2362,  
> >  29672KiB New:
> >  Reads Completed:        0,        0KiB  Writes Completed:      550,    
> > 5960KiB
> 
> It looks like the new method is only doing 1/6th as much i/o. Do you
> know what's going on there?
While I was surprised by the amount of difference I am not surprised at all 
that there is a significant one - currently the fsync will write out a whole 
bunch of useless stuff every time its called (all metadata, directory structure 
and so on)

This is reproducible...

6MB sounds sensible for the operation btw - the template database is around 
5MB.


Will try to analyze later what exactly causes the additional io.


Andres