Received: from maia.hub.org (unknown [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 61F261337B6E for ; Fri, 22 Oct 2010 01:05:48 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 40317-01 for ; Fri, 22 Oct 2010 04:05:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 143771337B67 for ; Fri, 22 Oct 2010 01:05:38 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o9M45SgO013039; Fri, 22 Oct 2010 00:05:28 -0400 (EDT) To: Greg Smith cc: Kevin Grittner , Bruce Momjian , jd@commandprompt.com, Scott Marlowe , Steve Crawford , pgsql-performance@postgresql.org, Ben Chobot Subject: Re: BBU Cache vs. spindles In-reply-to: <4CC1094C.1090306@2ndquadrant.com> References: <4CC04EA50200002500036C5E@gw.wicourts.gov> <201010211935.o9LJZTM21744@momjian.us> <4CC0513E0200002500036C68@gw.wicourts.gov> <4CC1094C.1090306@2ndquadrant.com> Comments: In-reply-to Greg Smith message dated "Thu, 21 Oct 2010 23:47:24 -0400" Date: Fri, 22 Oct 2010 00:05:27 -0400 Message-ID: <13038.1287720327@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/375 X-Sequence-Number: 40793 Greg Smith writes: > At this point, you now have a torn 8K page, with 1/2 old and 1/2 new > data. Right. > Without a full page write in the WAL, is it always possible to > restore its original state now? In theory, I think you do. Since the > delta in the WAL should be overwriting all of the bytes that changed > between the old and new version of the page, applying it on top of any > four possible states here: You've got entirely too simplistic a view of what the "delta" might be, I fear. In particular there are various sorts of changes that involve inserting the data carried in the WAL record and shifting pre-existing data around to make room, or removing an item and moving remaining data around. If you try to replay that type of action against a torn page, you'll get corrupted results. We could possibly redefine the WAL records so that they weren't just the minimum amount of data but carried every byte that'd changed on the page, and then I think what you're envisioning would work. But the records would be a lot bulkier. It's not clear to me that this would be a net savings over the current design, particularly not if there's a long interval between checkpoints. regards, tom lane