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 1rz7Cu-001yJs-MR for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Apr 2024 03:52:36 +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 1rz7Cq-005kiz-Kl for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Apr 2024 03:52:32 +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 1rz7Cq-005kiq-B7 for pgsql-hackers@lists.postgresql.org; Tue, 23 Apr 2024 03:52:32 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rz7Cn-002SJ0-MS for pgsql-hackers@lists.postgresql.org; Tue, 23 Apr 2024 03:52:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 43N3qL983228678; Mon, 22 Apr 2024 23:52:21 -0400 From: Tom Lane To: Jeff Davis cc: Nathan Bossart , Corey Huinker , Magnus Hagander , Stephen Frost , Ashutosh Bapat , Matthias van de Meent , Peter Smith , PostgreSQL Hackers , Tomas Vondra Subject: Re: Statistics Import and Export In-reply-to: <1d70aabacd379ed8f9a7db1bf4ca22d1f5cd943f.camel@j-davis.com> References: <1841621.1712093467@sss.pgh.pa.us> <06286ee47fa4b06b6e7f08da21958d7e35525ed4.camel@j-davis.com> <149855.1712164687@sss.pgh.pa.us> <261289.1712174567@sss.pgh.pa.us> <1798867.1712376328@sss.pgh.pa.us> <20240417165053.GA3253364@nathanxps13> <0943da4616837682c65e4620050b8b1e86fe3503.camel@j-davis.com> <3156140.1713817153@sss.pgh.pa.us> <1d70aabacd379ed8f9a7db1bf4ca22d1f5cd943f.camel@j-davis.com> Comments: In-reply-to Jeff Davis message dated "Mon, 22 Apr 2024 19:48:02 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3228676.1713844341.1@sss.pgh.pa.us> Date: Mon, 22 Apr 2024 23:52:21 -0400 Message-ID: <3228677.1713844341@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jeff Davis writes: > On Mon, 2024-04-22 at 16:19 -0400, Tom Lane wrote: >> Loading data without stats, and hoping >> that auto-analyze will catch up sooner not later, is exactly the >> current behavior that we're doing all this work to get out of. > That's the disconnect, I think. For me, the main reason I'm excited > about this work is as a way to solve the bad-plans-after-upgrade > problem and to repro planner issues outside of production. Avoiding the > need to ANALYZE at the end of a data load is also a nice convenience, > but not a primary driver (for me). Oh, I don't doubt that there are use-cases for dumping stats without data. I'm just dubious about the reverse. I think data+stats should be the default, even if only because pg_dump's default has always been to dump everything. Then there should be a way to get stats only, and maybe a way to get data only. Maybe this does argue for a four-section definition, despite the ensuing churn in the pg_dump API. > Should we just itemize some common use cases for pg_dump, and then > choose the defaults that are least likely to cause surprise? Per above, I don't find any difficulty in deciding what should be the default. What I think we need to consider is what the pg_dump and pg_restore switch sets should be. There's certainly a few different ways we could present that; maybe we should sketch out the details for a couple of ways. regards, tom lane