Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNbOD-0001ij-8h for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Jun 2017 08:53:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dNbOC-0007o2-Nw for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Jun 2017 08:53:28 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dNbMf-0004zT-Em for pgsql-hackers@postgresql.org; Wed, 21 Jun 2017 08:51:53 +0000 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dNbMb-00020F-Qk for pgsql-hackers@postgresql.org; Wed, 21 Jun 2017 08:51:52 +0000 Received: by mail-lf0-x241.google.com with SMTP id l200so7901522lfg.1 for ; Wed, 21 Jun 2017 01:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=HgQJs+7x25GKivJk/EX3+o70vBkrYzV8dkzytcuzuI4=; b=IvztSsK3Fb5hXDP9557+EOcXd4EF4NRhpfYqPTHgckwViInuT1+FKM/lXOudGmuT5K yIqMCiOwy57J8hyI6N93zeJjx8ylB0hyTDnGYrd8dhaCubGtLKuPwCgKCpTBsUai3nnC Qv7Q3WrHwOXNi3Mu+7Te2HWJXB5DZtk/NHN2n3tKbEh39Tsop/IlqdGwjrLJguEoLZYD n3tBEQ7B/nnN4bfX4FZ6EtYiscUnip2WK/8enPU8782RCc39pvXgVSBMFgTdFS6sk7M4 DCT38uTkSrFAsIGZc1I45Om2N6nBhmkCrqnArP9EHxoznmBxu75CoVbG9A9hTKgDkFhK qgjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=HgQJs+7x25GKivJk/EX3+o70vBkrYzV8dkzytcuzuI4=; b=RIwlfe/4KRtEKGxxdWC/kI2t+R5MZr1hMov3CGJRY60BVdwjnoE5jxAt2mWTFOTTk3 JzOPw+rJQMQF+YDeuI9R0bGt80LQq0/FDiXJ8x0CK5ANQ23/kf7IexpRwMun2fKwihTe nv1igRoesOuoUZ1FVZaReMzK3Jpttl/u1RS+PRil/eka9nOar4LRnOZrKaYYw3q1cOk9 Ri6CZj34LNA8mCvPeJfgYFoG8hFZut6RoyxeOYHgeSfUriBxEbxDnBobsCykoSvpKOO/ fs9D7sIASoIpRE02rwj196yUjT6ws/lCC5eJCTvEbhmqkNXX2Tk2nxbLzmbOqZKwTRRR Arkg== X-Gm-Message-State: AKS2vOyB8rRg+OC7ht82IR5ipXVGGWmHYtDcjLLyJJQhYx9+c1Yi1UqN EOHsiY5SHdtX/s9M X-Received: by 10.25.22.206 with SMTP id 75mr11422084lfw.158.1498035107721; Wed, 21 Jun 2017 01:51:47 -0700 (PDT) Received: from [192.168.1.99] (dsl-hkibng32-54fb4e-103.dhcp.inet.fi. [84.251.78.103]) by smtp.gmail.com with ESMTPSA id h70sm4631780lfh.38.2017.06.21.01.51.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jun 2017 01:51:47 -0700 (PDT) Subject: Re: AdvanceXLInsertBuffer vs. WAL segment compressibility To: Robert Haas , Bruce Momjian References: <579297F8.7020107@anastigmatix.net> <5797D953.6040806@anastigmatix.net> <20160802183347.GD32575@momjian.us> Cc: Chapman Flack , PostgreSQL Hackers From: Heikki Linnakangas Message-ID: <20943eba-bbb9-390c-01b1-e6704ce33c7b@iki.fi> Date: Wed, 21 Jun 2017 11:51:46 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org (I'm cleaning up my inbox, hence the delayed reply) On 08/02/2016 10:51 PM, Robert Haas wrote: > On Tue, Aug 2, 2016 at 2:33 PM, Bruce Momjian wrote: >> On Tue, Jul 26, 2016 at 05:42:43PM -0400, Chapman Flack wrote: >>> Even so, I'd be curious whether it would break anything to have >>> xlp_pageaddr simply set to InvalidXLogRecPtr in the dummy zero >>> pages written to fill out a segment. At least until it's felt >>> that archive_timeout has been so decidedly obsoleted by streaming >>> replication that it is removed, and the log-tail zeroing code >>> with it. >>> >>> That at least would eliminate the risk of anyone else repeating >>> my astonishment. :) I had read that 9.4 added built-in log-zeroing >>> code, and my first reaction was "cool! that may make the compression >>> technique we're using unnecessary, but certainly can't make it worse" >>> only to discover that it did, by ~ 300x, becoming now 3x *worse* than >>> plain gzip, which itself is ~ 100x worse than what we had. >> >> My guess is that the bytes are there to detect problems where a 512-byte >> disk sector is zeroed by a disk failure. I don't see use changing that >> for the use-case you have described. > > Is there actually any code that makes such a check? > > I'm inclined to doubt that was the motivation, though admittedly we're > both speculating about the contents of Heikki's brain, a tricky > proposition on a good day. Given that we used to just leave them as garbage, it seems pretty safe to zero them out now. It's kind of nice that all the XLOG pages have valid page headers. One way to think of the WAL switch record is that it's a very large WAL record that just happens to consume the rest of the WAL segment. Except that it's not actually represented like that; the xl_tot_len field of an XLOG switch record does not include the zeroed out portion. Instead, there's special handling in the reader code, that skips to the end of the segment when it sees a switch record. So that point is moot. When I wrote that code, I don't remember if I realized that we're initializing the page headers, or if I thought that it's good enough even if we do. I guess I didn't realize it, because a comment would've been in order if it was intentional. So +1 on fixing that, a patch would be welcome. In the meanwhile, have you tried using a different compression program? Something else than gzip might do a better job at the almost zero pages. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers