Mark Wong <markw@osdl.org> writes:
> I talked to Jan a little about this during OSCon since Linux filesystems
> (ext2, ext3, etc) let you use O_DIRECT. He felt the only place where
> PostgreSQL may benefit from this now, without managing its own buffer first,
> would be with the log writer. I'm probably going to get this wrong, but
> he thought it would be interesting to try an experiment by taking X number
> of pages to be flushed, sort them (by age? where they go on disk?) and
> write them out.
Hmm. Most of the time the log writer has little choice about page write
order --- certainly if all your transactions are small it's not going to
have any choice. I think this would mainly be equivalent to O_SYNC with
the extra feature of stopping the kernel from buffering the WAL data in
its own buffer cache. Which is probably useful, but I doubt it's going
to make a huge difference.
regards, tom lane