Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lsy5o-0004Yb-6u for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jun 2021 01:42:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lsy5n-0005LE-5a for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jun 2021 01:42:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lsy5m-0005L6-Qv for pgsql-hackers@lists.postgresql.org; Tue, 15 Jun 2021 01:42:14 +0000 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lsy5k-0005ZW-8C for pgsql-hackers@postgresql.org; Tue, 15 Jun 2021 01:42:14 +0000 Received: by mail-io1-xd31.google.com with SMTP id f10so27149950iok.6 for ; Mon, 14 Jun 2021 18:42:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8BZ7lr18b2+POQDJ17oVeN+vDmDEp6VD0VBZ9t5DI/g=; b=A60+hVlIhVew+EBJjlkr/ap/u45KTTiFLgdhp5LUIvSm3IVE6jN3SX344Ml7kVtB3d rma5pGCfpvC7IjfBD0OjqLNVNl2a9RSQm6AqmdktV0OKOpjX2N760Nrv0Ohz1KZeOogp /jTdeeB+p8Yi4kcx3zp2+Z1TF53tALLTuPI8V6e1iNoib+5MrVJQ1fsNavHiQB3UiFBK msblawG3K4C2WQocuyr+3nMwCQIwAPUn9jKV48FYHSSrtClShMiI423qLkuItZnRG3gM sPUiGR+SUP1NA1muN2DqNqrCE9Qk2MkTotwkLq2A73obpH6GHQsfy+eF12XSBMwlwsaH Tyqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8BZ7lr18b2+POQDJ17oVeN+vDmDEp6VD0VBZ9t5DI/g=; b=f6wPYFD6T9YVswIqqRufxtbbn2L7uTyxeME6oaExwl7JvV0hdKPUQOEK6cXjRoXqk6 w03uNRzyQAK8BvRB0WFpWLEosiQ/pgOkcu/hxd+2t7uiy32s1z4v3fOCJfAWgrqjMpSW TZeteheZZc4xXZeleMMQZ9zvWt+z9o3q4/8dr0cVC2J5+aOTN7ROM10l/1FAh/yOORal mL/xCvFOVSp+za0dMsBtJh5fAtwRrzHt2ap4AU27HGJwQrM1aiAyQb+vpuFkZ8pPdFKs yhM7Nxu2/nQLpFgT2ETl1XXKj/OIXCI0i4ukObWaG6OE3pte7tQ6Di6LhsIecJcymYjX QdXg== X-Gm-Message-State: AOAM532MoA9ZZ5WcV6sHjQrFTqwCb7WpkLi8J6Q9gZ+XHZB4LPxsKvIJ 3VYwtzs5tZdLoJs4JYh1Qp7oyA== X-Google-Smtp-Source: ABdhPJzey0R6u9R/l81tQ7LqcEPvuyFZdxRfWAn7eWXC0P4nxUoUxPcTSmzk0XDCkJIdyHk5bZ1bTg== X-Received: by 2002:a5e:df42:: with SMTP id g2mr16698478ioq.166.1623721330063; Mon, 14 Jun 2021 18:42:10 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k9sm47853ils.4.2021.06.14.18.42.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jun 2021 18:42:09 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 7E01C800A39; Mon, 14 Jun 2021 20:42:08 -0500 (CDT) Date: Mon, 14 Jun 2021 20:42:08 -0500 From: Justin Pryzby To: Michael Paquier Cc: Andrey Borodin , pgsql-hackers@postgresql.org, Thomas Munro , Peter Geoghegan , Andres Freund Subject: Re: Different compression methods for FPI Message-ID: <20210615014208.GK31772@telsasoft.com> References: <20210321193004.GA4203@telsasoft.com> <20210519030618.GS373@telsasoft.com> <20210525044444.GV3676@telsasoft.com> <3252174C-C21D-4711-A038-5230DE465BAE@yandex-team.ru> <20210614012412.GA31772@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jun 15, 2021 at 09:50:41AM +0900, Michael Paquier wrote: > On Sun, Jun 13, 2021 at 08:24:12PM -0500, Justin Pryzby wrote: > > I think it's more nuanced than just finding the algorithm with the least CPU > > use. The GUC is PGC_USERSET, and it's possible that a data-loading process > > might want to use zlib for better compress ratio, but an interactive OLTP > > process might want to use lz4 or no compression for better responsiveness. > > It seems to me that this should be a PGC_SUSET, at least? We've had > our share of problems with assumptions behind data leaks depending on > data compressibility (see ssl_compression and the kind). It's USERSET following your own suggestion (which is a good suggestion): On Mon, May 17, 2021 at 04:44:11PM +0900, Michael Paquier wrote: > + {"wal_compression_method", PGC_SIGHUP, WAL_SETTINGS, > + gettext_noop("Set the method used to compress full page images in the WAL."), > + NULL > + }, > + &wal_compression_method, > + WAL_COMPRESSION_PGLZ, wal_compression_options, > + NULL, NULL, NULL > Any reason to not make that user-settable? If you merge that with > wal_compression, that's not an issue. I don't see how restricting it to superusers would mitigate the hazard at all: If the local admin enables wal compression, then every user's data will be compressed, and the degree of compression indicatates a bit about their data, no matter whether it's pglz or lz4. It's probably true without compression, too - the fraction of FPW might reveal their usage patterns. > > In this patch series, I added compression information to the errcontext from > > xlog_block_info(), and allow specifying compression levels like zlib-2. I'll > > rearrange that commit earlier if we decide that's desirable to include. > > The compression level may be better if specified with a different > GUC. That's less parsing to have within the GUC machinery. I'm not sure about that - then there's an interdependency between GUCs. If zlib range is 1..9, and zstd is -50..10, then you may have to set the compression level first, to avoid an error. I believe there's a previous discussion about inter-dependent GUCs, and maybe a commit fixing a problem they caused. But I cannot find it offhand. > seems to me that if we can get the same amount of compression and CPU > usage just by tweaking the compression level, there is no need to > support more than one extra compression algorithm, easing the life of > packagers and users. I don't think it eases it for packagers, since I anticipate the initial patch would support {none/pglz/lz4/zlib}. I anticipate that zstd may not be in pg15. The goal of the patch is to give options, and the overhead of adding both zlib and lz4 is low. zlib gives good compression at some CPUcost and may be preferable for (some) DWs, and lz4 is almost certainly better (than pglz) for OLTPs. -- Justin