Hello Cédric,

It looks a bit hazardous, do you have a benchmark for freeBSD ?

No, I just consulted the FreeBSD man page for posix_fadvise. I someone can run tests on something which HDDs is not linux, that would be nice.

Sources says:
        case POSIX_FADV_DONTNEED:
                /*
                 * Flush any open FS buffers and then remove pages
                 * from the backing VM object.  Using vinvalbuf() here
                 * is a bit heavy-handed as it flushes all buffers for
                 * the given vnode, not just the buffers covering the
                 * requested range.

It is indeed heavy-handed, but that would probably trigger the expected behavior which is to start writing to disk, so I would expect to see benefits similar to those of "sync_file_range" on Linux.

Buffer writes from bgwriter & checkpointer are throttled, which reduces the potential impact of a "heavy-handed" approach in the kernel.

Now if on some platforms the behavior is absurd, obviously it would be better to turn the feature off on those.

Note that this is already used by pg in "initdb", but the impact would probably be very small anyway.

--
Fabien.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to