Re: initdb and fsync

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Andres Freund <andres@2ndquadrant.com>, pgsql-hackers@postgresql.org, Peter Eisentraut <peter_e@gmx.net>
Date: 2012-07-13T23:43:14Z
Lists: pgsql-hackers
Jeff Davis <pgsql@j-davis.com> writes:
> One point about the commit message: fadvise does not block to go into
> the request queue, sync_file_range does. The problem with fadvise is
> that, when the request queue is small, it fills up so fast that most of
> the requests never make it in, and fadvise is essentially a no-op.
> sync_file_range waits for room in the queue, which is (based on my
> tests) enough to improve the scheduling a lot.

I see.  I misunderstood your previous message.  In that case, it seems
quite likely that it might be helpful if copy_file were to aggregate
the fadvise/sync_file_range calls over larger pieces of the file.
(I'm assuming that the request queue isn't bright enough to aggregate
by itself, though that might be wrong.)

			regards, tom lane