On 2014-01-13 15:53:36 -0500, Trond Myklebust wrote: > > I've wondered before if there wouldn't be a chance for postgres to say > > "my dear OS, that the file range 0-8192 of file x contains y, no need to > > reread" and do that when we evict a page from s_b but I never dared to > > actually propose that to kernel people... > > O_DIRECT was specifically designed to solve the problem of double buffering > between applications and the kernel. Why are you not able to use that in > these situations?
Because we like to handle the OS handle part of postgres' caching. For one, it makes servers with several applications/databases much more realistic without seriously overallocating memory, for another it's a huge chunk of platform dependent code to get good performance everywhere. The above was explicitly not to avoid double buffering but to move a buffer away from postgres' own buffers to the kernel's buffers once it's not 100% clear we need it in buffers anymore. Part of the reason this is being discussed is because previously people suggested going the direct IO route and some people (most prominently J. Corbet in http://archives.postgresql.org/message-id/20131204083345.31c60dd1%40lwn.net ) and others disagreed because that goes the route of reinventing storage layers everywhere without improving the common codepaths. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers