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 1pYADO-0003HJ-Q3 for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Mar 2023 18:33:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pYADN-0001U1-E7 for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Mar 2023 18:33:09 +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 1pYADN-0001Ts-2j for pgsql-hackers@lists.postgresql.org; Fri, 03 Mar 2023 18:33:09 +0000 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pYADK-0006LX-By for pgsql-hackers@postgresql.org; Fri, 03 Mar 2023 18:33:08 +0000 Received: by mail-oi1-x230.google.com with SMTP id bj30so2480559oib.6 for ; Fri, 03 Mar 2023 10:33:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=timescale.com; s=google; t=1677868384; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lPaew5mTyz2Oxqa051op8jeLjGLZj6QxaHpB3VdZWiI=; b=eHDwltIVTpujAY7PlEk9UHBCQP+DT1MRm144YJgl0CyjwL7ZwXHzV7zjNnd6n88KLZ 290HbEeTcw1IIDwDIVad0jvSdQ4dKKRsOx01kDL85GHvBsCEtfeyl9L+ui/sdQXhAdfK 9CAD9G6iJnap5NZpTuCVMlOz2peAYGsdsLRLl6lOUCTqSmTYhHFzJNUd6wPfO8rlan6N nH0JibEyowhWlWHsyTGQUvDV4xA9DUxdkRbqxmCIFWd7a3XDVWO/1FZNizVbrtWDfMoh 3rGDsWAJt+FXrwax8h4VfVigys8StzqE7+CrGSccay76/Vu+RU7E/flLGGBjPu+Pjfgw ra2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677868384; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lPaew5mTyz2Oxqa051op8jeLjGLZj6QxaHpB3VdZWiI=; b=rNRYi2t2aEWHDWRHsJmAnDTUnzPU8Y2qZW3DraAVABaY0QoShTj9/mu3TghnR3etHC XJeoYkUOyLnz3uqM3FnA/GgLv2083YjEUTo9frkYEWB2pv6JB/TyOFAe/P283lwZZip7 qBI21PTPu1NL1TSWF/HqB8mHKNeW/1y6BEjF65L9UZl5XEPEoRMPyYd+dK4QOpszFv8u sZegk5BRX+XOU4pdgliW0tWqV4UqEsIpcvdle8pkKHLcNCSZDrqq11o2ODXht3RKDI1t nn0RWh3HLs/0LQfa6e4nZZlJy8I5mFB2HMGZ3IhDxcJdx3JlhwT8R1zYY5XHI2NKi3II RCTA== X-Gm-Message-State: AO0yUKX+w6vQo6IV9/aRM5skzlqt0+xAt0wjL3+MbuMizJdXrNdTTezg sUSpZ3tcHu9G+JBY7OxVyd1iBvill5xPA0wlMBbi+Q== X-Google-Smtp-Source: AK7set/ssz12buP6FgOu29p7bbyvuCzNHZctaKi2sGziYdyEIm/ZVbXVL3SduHYH2ziI2tfTtg9u0r3p8/+iwa/G1SY= X-Received: by 2002:a05:6808:8f7:b0:36e:f6f5:5cf0 with SMTP id d23-20020a05680808f700b0036ef6f55cf0mr819074oic.3.1677868384675; Fri, 03 Mar 2023 10:33:04 -0800 (PST) MIME-Version: 1.0 References: <20230224191840.GD1653@telsasoft.com> <20230226012227.GK1653@telsasoft.com> In-Reply-To: <20230226012227.GK1653@telsasoft.com> From: Jacob Champion Date: Fri, 3 Mar 2023 10:32:53 -0800 Message-ID: Subject: Re: zstd compression for pg_dump To: Justin Pryzby 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Feb 25, 2023 at 5:22=E2=80=AFPM Justin Pryzby wrote: > This resolves cfbot warnings: windows and cppcheck. > And refactors zstd routines. > And updates docs. > And includes some fixes for earlier patches that these patches conflicts > with/depends on. This'll need a rebase (cfbot took a while to catch up). The patchset includes basebackup modifications, which are part of a different CF entry; was that intended? I tried this on a local, 3.5GB, mostly-text table (from the UK Price Paid dataset [1]) and the comparison against the other methods was impressive. (I'm no good at constructing compression benchmarks, so this is a super naive setup. Client's on the same laptop as the server.) $ time ./src/bin/pg_dump/pg_dump -d postgres -t pp_complete -Z zstd > /tmp/zstd.dump real 1m17.632s user 0m35.521s sys 0m2.683s $ time ./\src/bin/pg_dump/pg_dump -d postgres -t pp_complete -Z lz4 > /tmp/lz4.dump real 1m13.125s user 0m19.795s sys 0m3.370s $ time ./\src/bin/pg_dump/pg_dump -d postgres -t pp_complete -Z gzip > /tmp/gzip.dump real 2m24.523s user 2m22.114s sys 0m1.848s $ ls -l /tmp/*.dump -rw-rw-r-- 1 jacob jacob 1331493925 Mar 3 09:45 /tmp/gzip.dump -rw-rw-r-- 1 jacob jacob 2125998939 Mar 3 09:42 /tmp/lz4.dump -rw-rw-r-- 1 jacob jacob 1215834718 Mar 3 09:40 /tmp/zstd.dump Default gzip was the only method that bottlenecked on pg_dump rather than the server, and default zstd outcompressed it at a fraction of the CPU time. So, naively, this looks really good. With this particular dataset, I don't see much improvement with zstd:long. (At nearly double the CPU time, I get a <1% improvement in compression size.) I assume it's heavily data dependent, but from the notes on --long [2] it seems like they expect you to play around with the window size to further tailor it to your data. Does it make sense to provide the long option without the windowLog parameter? Thanks, --Jacob [1] https://landregistry.data.gov.uk/ [2] https://github.com/facebook/zstd/releases/tag/v1.3.2