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 1lNXjb-0005bK-HA for pgsql-hackers@arkaria.postgresql.org; Sat, 20 Mar 2021 09:17:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lNXfG-0007H7-PG for pgsql-hackers@arkaria.postgresql.org; Sat, 20 Mar 2021 09:12:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lNXem-0005Rl-QL for pgsql-hackers@lists.postgresql.org; Sat, 20 Mar 2021 09:12:28 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lNP93-0007HW-Qw for pgsql-hackers@lists.postgresql.org; Sat, 20 Mar 2021 00:07:19 +0000 Received: by mail-io1-xd2e.google.com with SMTP id z3so7911595ioc.8 for ; Fri, 19 Mar 2021 17:07:05 -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:mime-version:content-disposition :in-reply-to:user-agent; bh=+rPyLZyL6G5Jzs098PNTfIM9bCDIlp2/6P3dX9PcgOU=; b=Z8pXeD+4dFZFk4fc7q6vlZ3K6wvro8uQ3oiLhXpTMFNlA/yVbfso66TY12S0hOXfeZ WDH+w6zwsAIsIY9D4ecPUJq/cC0SrgI3tWBET3jiLLzGHfrHEempP6Up41FY89nQQNaH wNDb8ZluDwUmkRr5dZDqFPI2PXWVa3JeN6ZBgWBEQ/IWsZ4WzqrOZr2IdFjzaMrFHV0n D4iqZnrBISAuwzkDnn8cXgpqzn94WogdirDTOwXfgFRB1lDMG9tL2VhJH4lEApOXylo7 89EKTLe0LSAWMXk0aLiPtPOZNsLGZbzJgEgBwtTWhgtj5/6KuzC5gBJd7h6SaaTyfdly 5aQw== 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:mime-version :content-disposition:in-reply-to:user-agent; bh=+rPyLZyL6G5Jzs098PNTfIM9bCDIlp2/6P3dX9PcgOU=; b=YvlRi/mRFBGLj2WX24NKJOjYLVJLb5vr0fqnuHvAjQkGshmCH6tTUTmu8ACQRPHsq8 ff/kf2sO2WwR0GvsWBnOgCKEZ6Igb7u23wQtgxQX8DYgWkjD1GvPB2ybIBKCY74jN1US OFDGYsXUmjHP/TYqmQvhYepuGbjvoD+TQZy1dMD4x8sGKo72BlfIEjHDAGHjDvGJD15H bNMEKFx0Xvd7u0y9Ut/iIUxeyk5t2ULs1dzT86qMIKKvtScM7+SoxNvQtvmhC8jk7tn8 liom90AqOgx0CPolYBfu7rBQJfvk19e+8L49AUmKEmMZLRyNYcQO5/54xyej1TPTfPn+ iypA== X-Gm-Message-State: AOAM5308vVYdAVI9kGTWwYFq1xXZF9TgAXqRfrT9uBW7VmgVp4Ku4FxE Pjxc3YBFpzGvXGWdXNmmbpQ8mg== X-Google-Smtp-Source: ABdhPJwGkOXrJ7P/qleg1oJvMoIorLkvCFO0eTwBQk9mxMgBd0wt/GDI0BTdRp+JUZ54IZRjqsQmSQ== X-Received: by 2002:a6b:ec14:: with SMTP id c20mr4668817ioh.122.1616198788001; Fri, 19 Mar 2021 17:06:28 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id t9sm3234395ioi.27.2021.03.19.17.06.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Mar 2021 17:06:27 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 1B955800870; Fri, 19 Mar 2021 19:06:26 -0500 (CDT) Date: Fri, 19 Mar 2021 19:06:25 -0500 From: Justin Pryzby To: Tom Lane , Robert Haas , Alvaro Herrera Cc: Dilip Kumar , Andres Freund , Tomas Vondra , Alexander Korotkov , David Steele , Ildus Kurbangaliev , Dmitry Dolgov <9erthalion6@gmail.com>, PostgreSQL Hackers Subject: Re: [HACKERS] Custom compression methods Message-ID: <20210320000625.GP11765@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210319222242.GA23930@alvherre.pgsql> <4158590.1616185209@sss.pgh.pa.us> 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 Fri, Mar 19, 2021 at 04:38:03PM -0400, Robert Haas wrote: > On Fri, Mar 19, 2021 at 4:20 PM Tom Lane wrote: > > Nope ... crake's displeased with your assumption that it's OK to > > clutter dumps with COMPRESSION clauses. As am I: that is going to > > be utterly fatal for cross-version transportation of dumps. > > Regarding your point, that does look like clutter. We don't annotate > the dump with a storage clause unless it's non-default, so probably we > should do the same thing here. I think I gave Dilip bad advice here... On Fri, Mar 19, 2021 at 05:49:37PM -0400, Robert Haas wrote: > Here's a patch for that. It's a little strange because you're going to > skip dumping the toast compression based on the default value on the > source system, but that might not be the default on the system where > the dump is being restored, so you could fail to recreate the state > you had. That is avoidable if you understand how things work, but some > people might not. I don't have a better idea, though, so let me know > what you think of this. On Fri, Mar 19, 2021 at 07:22:42PM -0300, Alvaro Herrera wrote: > Do you mean the column storage strategy, attstorage? I don't think > that's really related, because the difference there is not a GUC setting > but a compiled-in default for the type. In the case of compression, I'm > not sure it makes sense to do it like that, but I can see the clutter > argument: if we dump compression for all columns, it's going to be super > noisy. > > (At least, for binary upgrade surely you must make sure to apply the > correct setting regardless of defaults on either system). > > Maybe it makes sense to dump the compression clause if it is different > from pglz, regardless of the default on the source server. Then, if the > target server has chosen lz4 as default, *all* columns are going to end > up as lz4, and if it hasn't, then only the ones that were lz4 in the > source server are going to. That seems reasonable behavior. Also, if > some columns are lz4 in source, and target does not have lz4, then > everything is going to work out to not-lz4 with just a bunch of errors > in the output. I think what's missing is dumping the GUC value itself, and then also dump any columns that differ from the GUC's setting. An early version of the GUC patch actually had an "XXX" comment about pg_dump support, and I was waiting for a review before polishing it. This was modelled after default_tablespace and default_table_access_method - I've mentioned that before that there's no pg_restore --no-table-am, and I have an unpublished patch to add it. That may be how I missed this until now. Then, this will output COMPRESSION on "a" (x)or "b" depending on the current default: | CREATE TABLE a(a text compression lz4, b text compression pglz); When we restore it, we set the default before restoring columns. I think it may be a good idea to document that dumps of columns with non-default compression aren't portable to older server versions, or servers --without-lz4. This is a consequence of the CREATE command being a big text blob, so pg_restore can't reasonably elide the COMPRESSION clause. While looking at this, I realized that someone added the GUC to postgresql.conf.sample, but not to doc/ - this was a separate patch until yesterday. I think since we're not doing catalog access for "pluggable" compression, this should just be an enum GUC, with #ifdef LZ4. Then we don't need a hook to validate it. ALTER and CREATE are silently accepting bogus compression names. I can write patches for these later. -- Justin