Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> Long story short, when a CLOG-related stall happens,
> essentially all the time is being spent in this here section of code:
> /*
> * If not part of Flush, need to fsync now. We assume this happens
> * infrequently enough that it's not a performance issue.
> */
> if (!fdata) // fsync and close the file
Seems like basically what you've proven is that this code path *is* a
performance issue, and that we need to think a bit harder about how to
avoid doing the fsync while holding locks.
regards, tom lane