Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uUCuX-00HGw8-Hf for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Jun 2025 23:18:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uUCuV-00FmSN-0p for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Jun 2025 23:18:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uUCuU-00FmSE-NV for pgsql-hackers@lists.postgresql.org; Tue, 24 Jun 2025 23:18:39 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uUCuS-003umT-0W for pgsql-hackers@postgresql.org; Tue, 24 Jun 2025 23:18:39 +0000 Received: from [192.168.11.9] (p1696134-ipoe.ipoe.ocn.ne.jp [118.0.93.133]) by oss.nttdata.com (Postfix) with ESMTPSA id 8FF4861974; Wed, 25 Jun 2025 08:18:29 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: <3cc4f166-0b58-47e2-a03c-7c2873d62b14@oss.nttdata.com> Date: Wed, 25 Jun 2025 08:18:28 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pg_dump --with-* options To: Robert Haas , Nathan Bossart Cc: Jeff Davis , Peter Eisentraut , pgsql-hackers References: <7cc52488-f876-4ad3-affd-6e4b0ef0cb09@eisentraut.org> <7bf0246542713d80f12c738c1d365d1365750c18.camel@j-davis.com> <5e398522803da9bf3f9fc33ca43084ec21ab0fcd.camel@j-davis.com> <031558c60e84362898922caa6a90587e7fdf2a57.camel@j-davis.com> Content-Language: en-US From: Fujii Masao In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025/06/25 5:07, Robert Haas wrote: > On Tue, Jun 24, 2025 at 12:48 PM Nathan Bossart > wrote: >> On Mon, Jun 23, 2025 at 01:38:10PM -0400, Robert Haas wrote: >>> I had thought we had a consensus that pg_upgrade should preserve stats >>> but regularly pg_dump shouldn't include them; perhaps I misunderstood >>> or that changed. >> >> I think it's a bit of both. I skimmed through the past discussions and >> found that not only was there a rough consensus in 2024 that stats _should_ >> be on by default [0], but also that an updated vote tally didn't show much >> of a consensus at all [1]. Like you, I thought we had pretty much closed >> that door, but the aforementioned analysis along with further discussion >> has me convinced that we might want to reconsider [2]. > > Well, I don't know: I still think that's the right answer, so I don't > really want to reconsider, but I understand that I'm not in charge > here. For the record, my vote is: default "off" for pg_dump and pg_dumpall, and "on" for pg_restore. For pg_dump and pg_dumpall, I agree with Jeff's idea in [1], but if the statistics is skipped by default, I don't think we need a --no-statistics option. So, here's how I think the options should work: * Keep: --schema-only, --data-only, --statistics-only, --no-schema, --no-data, -and -statistics * Remove: --no-statistics, --with-schema, and --with-data * Combinations: Schema + Data + Stats : --statistics Schema + Data : (default) Schema + Stats : --no-data --statistics Data + Stats : --no-schema --statistics Schema only : --schema-only (or --no-data) Data only : --data-only (or --no-schema) Stats only : --statistics-only (or --no-schema --no-data --statistics) As I mentioned in [2], if we treat --statistics in the similar way to --sequence-data, i.e., allow --statistics to be used with --schema-only or --data-only, we could simplify further: * Keep: --schema-only, --data-only, --statistics-only, and --statistics * Remove: --no-schema, --no-data, --no-statistics, --with-schema, and --with-data * Combinations: Schema + Data + Stats : --statistics Schema + Data : (default) Schema + Stats : --schema-only --statistics Data + Stats : --data-only --statistics Schema only : --schema-only Data only : --data-only Stats only : --statistics-only Some may find this confusing due to mixing --statistics with --schema-only or --data-only, so I understand if there's hesitation. For pg_restore, I believe there's agreement to restore statistics by default if they exist in the archive. So: * Keep: --schema-only, --data-only, --statistics-only, --no-schema, --no-data, and --no-statistics * Remove: --with-schema, --with-data, and --statistics * Combinations: Schema + Data + Stats : (default) Schema + Data : --no-statistics Schema + Stats : --no-data Data + Stats : --no-schema Schema only : --schema-only (or --no-data --no-statistics) Data only : --data-only (or --no-schema --no-statistics) Stats only : --statistics-only (or --no-schema --no-data) Thought? Regards, [1] https://postgr.es/m/031558c60e84362898922caa6a90587e7fdf2a57.camel@j-davis.com [2] https://postgr.es/m/94f89b0a-5d83-4a67-9092-50ba3913441c@oss.nttdata.com -- Fujii Masao NTT DATA Japan Corporation