Skip site navigation (1) Skip section navigation (2)

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

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org, Michael Clemmons <glassresistor(at)gmail(dot)com>, Hannu Krosing <hannu(at)2ndquadrant(dot)com>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Subject: Re: Faster CREATE DATABASE by delaying fsync (was 8.4.1 ubuntu karmic slow createdb)
Date: 2010-01-18 16:35:59
Message-ID: 407d949e1001180835m79ffe3e4w53e20ce2e1a58f2d@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-performance
Looking at this patch for the commitfest I have a few questions.

1) You said you added an fsync of the new directory -- where is that I
don't see it anywhere.

2) Why does the second pass to do the fsyncs read through fromdir to
find all the filenames. I find that odd and counterintuitive. It would
be much more natural to just loop through the files in the new
directory. But I suppose it serves as an added paranoia check that the
files are in fact still there and we're not fsyncing any files we
didn't just copy. I think it should still work, we should have an
exclusive lock on the template database so there really ought to be no
differences between the directory trees.

3) It would be tempting to do the posix_fadvise on each chunk as we
copy it. That way we avoid poisoning the filesystem cache even as far
as a 1G file. This might actually be quite significant if we're built
without the 1G file chunk size. I'm a bit concerned that the code will
be a big more complex having to depend on a good off_t definition
though. Do we only use >1GB files on systems where off_t is capable of
handling >2^32 without gymnastics?

-- 
greg

In response to

Responses

pgsql-performance by date

Next:From: fkater@googlemail.comDate: 2010-01-18 16:38:44
Subject: Re: Inserting 8MB bytea: just 25% of disk perf used?
Previous:From: fkater@googlemail.comDate: 2010-01-18 16:13:15
Subject: Re: Inserting 8MB bytea: just 25% of disk perf used?

pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2010-01-18 17:30:19
Subject: Re: Hot Standby and handling max_standby_delay
Previous:From: Markus WannerDate: 2010-01-18 16:19:08
Subject: Re: Testing with concurrent sessions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group