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 1kwJwT-0003UJ-Jd for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Jan 2021 07:06:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kwJwQ-000843-Vp for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Jan 2021 07:06:10 +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 1kwJwQ-00083w-Kc for pgsql-hackers@lists.postgresql.org; Mon, 04 Jan 2021 07:06:10 +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 1kwJwL-00070u-Ir for pgsql-hackers@postgresql.org; Mon, 04 Jan 2021 07:06:09 +0000 Received: by mail-io1-xd2e.google.com with SMTP id q137so24088861iod.9 for ; Sun, 03 Jan 2021 23:06:05 -0800 (PST) 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:content-transfer-encoding:in-reply-to :user-agent; bh=Z1Sag6ojqibX3FZB0e/+ZdKG3ifeViDpKvHHHqEV/6M=; b=FySbvMfGUVwVo93CnN//n4iJiY2DA0Xvkm1ewWnUBUcADmspNd5Tg+BYIS5eRRzG+9 nw2Stgu2oTH4ufwZnjlgnSu9KpF1MffA5VkIYHtN4fgAJAY2AKcIepCh/4+AfsoZlduD GT8r1qeBEpeul2Hi0RpzR4V96m9zQtpXWwQC8jiDJ1BME/Fk0E/Zntn4oPIoswDtRGYX in3nX4MgJtc8LLAT4Ov1gKYoXsVcnCPtvT4t+KPFKoh2JdK4aWbuZXB+KeCFDaPNO//K GkWPvwAmHzNsbu9ESviA5Ew4yS+u1HImnelof+4AL9TxQ8n3ASuXGKVN6VvNDfRFwZg6 bO6w== 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:content-transfer-encoding :in-reply-to:user-agent; bh=Z1Sag6ojqibX3FZB0e/+ZdKG3ifeViDpKvHHHqEV/6M=; b=bdlHG3Tg4f31rK9LpWuAz5ARsEWVqls4ADjQ8C6hOJnFXBDaSxugiPko9v6Mk5ISJ2 boDxKpbHYBY9aV/AglpHFgAo5jzAc03YzXX69OAC9lNMcwcNWuUjEdxQb7eMkx4MfHLe Wmu8EIygPCbCbFaoxOTWfUuOAfGw9X0GiSsenJaVXVert88hIxX8rxFtwnJ6CvMglUhf p4LPwkk1IqenWb+CwucuSszQsBXog2zlfV6hIuNuQiLG0zAQnJynMe+3+TTwGxqqwqJq 1ClIc5BhyEdjsiKm917oO6XNsKrQ9F5bl0sb0C5lLrtMDZC4qkcniBsZh26hmcHm6W+O rGKw== X-Gm-Message-State: AOAM532wl0Th0j61TXLa9ViUDvWHhaazElpUUSDSIuiGV8NcVV3bZkiU IaPU/lIn9UFv6bsViuXkdB/PLNsxzBTC4w== X-Google-Smtp-Source: ABdhPJzH2vr3HOOIgFYBr7QzsL2JVZ1NUKn3btoO9LYoUXzThSt4oHP73xdsrPZCl2ulX00Gg3xjhQ== X-Received: by 2002:a5d:80d2:: with SMTP id h18mr57290287ior.117.1609743964424; Sun, 03 Jan 2021 23:06:04 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id v66sm37120266iod.34.2021.01.03.23.06.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Jan 2021 23:06:03 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 1F25F801D06; Mon, 4 Jan 2021 01:06:01 -0600 (CST) Date: Mon, 4 Jan 2021 01:06:00 -0600 From: Justin Pryzby To: Andrey Borodin Cc: Tom Lane , pgsql-hackers , Daniil Zakhlystov Subject: Re: zstd compression for pg_dump Message-ID: <20210104070600.GB9712@telsasoft.com> References: <20201221194924.GI30237@telsasoft.com> <554920.1608580960@sss.pgh.pa.us> <20201222023235.GJ30237@telsasoft.com> <20210104025321.GA9712@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Jan 04, 2021 at 11:04:57AM +0500, Andrey Borodin wrote: > > 4 янв. 2021 г., в 07:53, Justin Pryzby написал(а): > > Note, there's currently several "compression" patches in CF app. This patch > > seems to be independent of the others, but probably shouldn't be totally > > uncoordinated (like adding lz4 in one and ztsd in another might be poor > > execution). > > > > https://commitfest.postgresql.org/31/2897/ > > - Faster pglz compression > > https://commitfest.postgresql.org/31/2813/ > > - custom compression methods for toast > > https://commitfest.postgresql.org/31/2773/ > > - libpq compression > > I think that's downside of our development system: patch authors do not want to create dependencies on other patches. I think in these cases, someone who notices common/overlapping patches should suggest that the authors review each other's work. In some cases, I think it's appropriate to come up with a "shared" preliminary patch(es), which both (all) patch authors can include as 0001 until its finalized and merged. That might be true for some things like the tableam work, or the two "online checksum" patches. > I'd say that both lz4 and zstd should be supported in TOAST, FPIs, libpq, and pg_dump. As to pglz - I think we should not proliferate it any further. pg_basebackup came up as another use on another thread, I think related to libpq protocol compression. > Libpq compression encountered some problems with memory consumption which > required some extra config efforts. Did you measure memory usage for this > patchset? RAM use is not significantly different from zlib, except that zstd --long adds more memory. $ command time -v pg_dump -d ts -t ... -Fc -Z0 |wc -c Elapsed (wall clock) time (h:mm:ss or m:ss): 0:28.77 Maximum resident set size (kbytes): 40504 1397288924 # no compression: 1400MB $ command time -v pg_dump -d ts -t ... -Fc |wc -c Elapsed (wall clock) time (h:mm:ss or m:ss): 0:37.17 Maximum resident set size (kbytes): 40504 132932415 # default (zlib) compression: 132 MB $ command time -v ./pg_dump -d ts -t ... -Fc |wc -c Elapsed (wall clock) time (h:mm:ss or m:ss): 0:29.28 Maximum resident set size (kbytes): 40568 86048139 # zstd: 86MB $ command time -v ./pg_dump -d ts -t ... -Fc -Z 'alg=zstd opt=zstdlong' |wc -c Elapsed (wall clock) time (h:mm:ss or m:ss): 0:30.49 Maximum resident set size (kbytes): 180332 72202937 # zstd long: 180MB > [PATCH 04/20] struct compressLibs > I think this directive would be correct. > +// #ifdef HAVE_LIBZ? I'm not sure .. I'm thinking of making the COMPR_ALG_* always defined, and then fail later if an operation is unsupported. There's an excessive number of #ifdefs already, so the early commits are intended to minimize as far as possible what's needed for each additional compression algorithm(lib/method/whatever it's called). I haven't tested much with pg_restore of files with unsupported compression libs. > [PATCH 06/20] pg_dump: zstd compression > I'd propose to build with Zstd by default. It seems other patches do it this way. Though, I there are possible downsides. Yes...but the cfbot turns red if the patch require zstd, so it defaults to off until it's included in the build environments (but for now, the main patch isn't being tested). Thanks for looking. -- Justin