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 1pYVCn-0000Un-JL for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Mar 2023 16:57:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pYVCm-0004PY-FV for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Mar 2023 16:57:56 +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 1pYVCm-0004PP-1c for pgsql-hackers@lists.postgresql.org; Sat, 04 Mar 2023 16:57:56 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pYVCi-0001Yu-1g for pgsql-hackers@postgresql.org; Sat, 04 Mar 2023 16:57:55 +0000 Received: by mail-il1-x12d.google.com with SMTP id l2so3812081ilg.7 for ; Sat, 04 Mar 2023 08:57:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; t=1677949070; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=u3cYowEvpuOACv82kDcrKF0jq7nZidqQxrvadd/HdXc=; b=rK3nhcYq4UuM0eKcrnsJ5yRaWtvjHqcnxDGxXkYEFrZvpak8b9pbzccywctIFSoAs4 O0e/QpbBvfQGd+Y+O/rTh+HEv2owfVrTgqTkv5nGh8ydvXgIW/nE4s9vtLt1st8E+2EI U6IWVG0+D9i64WgKp3w6PKht+orCmp12U2ZRY/x3SkE2cLgsF6bsseYFcf80+JD6+VFR GJh93gbFaycK9nhX8zKfQjv4rdlbBWX6gPR9E16rJG4Tcd7S3nNfxLxn2tb3UgvA7IyZ sbtVw5wv9iQNHucAGRby0662XkRvnMBudyW3LLx1ZtNUFbueWNwGqHUugmzDCx3UO4D2 196w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677949070; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u3cYowEvpuOACv82kDcrKF0jq7nZidqQxrvadd/HdXc=; b=E/IjcM54yQiw2qm9mr9ndAq7TPXm633izhsmq+qhczy+q4hwDxCE+GSH/taRw64ywH 9gjIEn9OYk2iOmIL98sFPsO6JolUGpi+9lujnrObvQd7ybycYv4WzyVZdlXn+TpGQ5Ze ybZcQRz57r6EdA6Y1V46uC0Ou2Ufq1yMaQlQIIpbdx0n8ahw5gXfqVvLUTLDQEW+iQzg A1GPmJNte4MJRubQv/9xr4moXGoSVCAZuwSwQrqjsO2Z9dLkxfGg7S/LWNBEtLDNSO7B 1SSdfjzhtOWH44d+fjLGoNFjbih7geoaxTBye28DGb0JYv+DATwhcwe+ehzMTvD5u9OH GMBg== X-Gm-Message-State: AO0yUKWdw0BQ8c5oFO0X06h7bHVy8xDjjUPVFVZ01mhyMlm+PUs8FlVW GwSARHGRVz1qlnVLv42ZKJtE6w== X-Google-Smtp-Source: AK7set8B0yfHFqyozj2U26JgxrttLyM1voJw8tmTYMrKUxEN1x9crF4jpUXxSt0n6GYmI/S6jceSYg== X-Received: by 2002:a05:6e02:218e:b0:316:f93f:6baa with SMTP id j14-20020a056e02218e00b00316f93f6baamr4308098ila.31.1677949070054; Sat, 04 Mar 2023 08:57:50 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id e12-20020a02caac000000b003c488204c6fsm1652570jap.76.2023.03.04.08.57.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Mar 2023 08:57:49 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 37B238012A0; Sat, 4 Mar 2023 10:57:48 -0600 (CST) Date: Sat, 4 Mar 2023 10:57:48 -0600 From: Justin Pryzby To: Jacob Champion Cc: pgsql-hackers@postgresql.org, gkokolatos@pm.me, Michael Paquier , Tomas Vondra , Robert Haas , Peter Geoghegan , Peter Eisentraut , Heikki Linnakangas , Thomas Munro , Dipesh Pandit , Andrey Borodin , Mark Dilger Subject: Re: zstd compression for pg_dump Message-ID: <20230304165747.GH12850@telsasoft.com> References: <20230224191840.GD1653@telsasoft.com> <20230226012227.GK1653@telsasoft.com> <20230303185546.GE12850@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 Fri, Mar 03, 2023 at 01:38:05PM -0800, Jacob Champion wrote: > > > With this particular dataset, I don't see much improvement with > > > zstd:long. > > > > Yeah. I this could be because either 1) you already got very good > > comprssion without looking at more data; and/or 2) the neighboring data > > is already very similar, maybe equally or more similar, than the further > > data, from which there's nothing to gain. > > What kinds of improvements do you see with your setup? I'm wondering > when we would suggest that people use it. On customer data, I see small improvements - below 10%. But on my first two tries, I made synthetic data sets where it's a lot: $ ./src/bin/pg_dump/pg_dump -d pryzbyj -Fp -Z zstd:long |wc -c 286107 $ ./src/bin/pg_dump/pg_dump -d pryzbyj -Fp -Z zstd:long=0 |wc -c 1709695 That's just 6 identical tables like: pryzbyj=# CREATE TABLE t1 AS SELECT generate_series(1,999999); In this case, "custom" format doesn't see that benefit, because the greatest similarity is across tables, which don't share compressor state. But I think the note that I wrote in the docs about that should be removed - custom format could see a big benefit, as long as the table is big enough, and there's more similarity/repetition at longer distances. Here's one where custom format *does* benefit, due to long-distance repetition within a single table. The data is contrived, but the schema of ID => data is not. What's notable isn't how compressible the data is, but how much *more* compressible it is with long-distance matching. pryzbyj=# CREATE TABLE t1 AS SELECT i,array_agg(j) FROM generate_series(1,444)i,generate_series(1,99999)j GROUP BY 1; $ ./src/bin/pg_dump/pg_dump -d pryzbyj -Fc -Z zstd:long=1 |wc -c 82023 $ ./src/bin/pg_dump/pg_dump -d pryzbyj -Fc -Z zstd:long=0 |wc -c 1048267 -- Justin