I think we have raised a number of interesting issues here which require
more deeper consideration. So I suggest to set this patch to Returned
with feedback.
Btw., I just learned that copy_file_range() only works on files on the
same device. So more arrangements will need to be made for that.
> I have run some more tests on both macOS and Linux with ext4, and my> results are that the bigger the flush distance,
thebetter. Before
we> made the adjustments for APFS, we had a flush size of 64kB, now it's
1MB> and 32MB on macOS. In my tests, I see 256MB as the best across
both> platforms, and not flushing early at all is only minimally worse.
Based on this, I suggest that we set the flush distance to 32MB on all
platforms. Not only is it faster, it avoids having different settings
on some platforms.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services