X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 83C3A8BB024 for ; Mon, 21 Feb 2005 16:27:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24876-10 for ; Mon, 21 Feb 2005 16:27:31 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 17B2F8BAFCF for ; Mon, 21 Feb 2005 16:27:30 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1LGRTJo000449; Mon, 21 Feb 2005 11:27:29 -0500 (EST) To: "Merlin Moncure" Cc: "Bruce Momjian" , "Magnus Hagander" , pgsql-performance@postgresql.org Subject: Re: seq scan cache vs. index cache smackdown In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3412A762F@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3412A762F@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Mon, 21 Feb 2005 09:03:20 -0500" Date: Mon, 21 Feb 2005 11:27:29 -0500 Message-ID: <448.1109003249@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/287 X-Sequence-Number: 10616 "Merlin Moncure" writes: > Is there a reason why readv/writev have not been considered in the past? Lack of portability, and lack of obvious usefulness that would justify dealing with the lack of portability. I don't think there's any value in trying to write ordinary buffers this way; making the buffer manager able to write multiple buffers at once sounds like a great deal of complexity and deadlock risk in return for not much. It might be an alternative to the existing proposed patch for writing multiple WAL buffers at once, but frankly I consider that patch a waste of effort. In real scenarios you seldom get to write more than one WAL page without a forced sync occurring because someone committed. Even if *your* transaction is long, any other backend committing a small transaction still fsyncs. On top of that, the bgwriter will be flushing WAL in order to maintain the write-ahead rule any time it dumps a dirty buffer. I have a personal to-do item to make the bgwriter explicitly responsible for writing completed WAL pages as part of its duties, but I haven't done anything about it because I think that it will write lots of such pages without any explicit code, thanks to the bufmgr's LSN interlock. Even if it doesn't get it done that way, the simplest answer is to add a little bit of code to make sure bgwriter generally does the writes, and then we don't care. If you want to experiment with writev, feel free, but I'll want to see demonstrable performance benefits before any such code actually goes in. regards, tom lane