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 1rqcgH-00DMq3-T5 for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Mar 2024 17:39:50 +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 1rqcgG-009lqV-UT for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Mar 2024 17:39:48 +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 1rqcgG-009lqN-KE for pgsql-hackers@lists.postgresql.org; Sat, 30 Mar 2024 17:39:48 +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 1rqcgD-007g9B-W2 for pgsql-hackers@lists.postgresql.org; Sat, 30 Mar 2024 17:39:48 +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 42UHde6J473885; Sat, 30 Mar 2024 13:39:40 -0400 From: Tom Lane To: Jeff Davis cc: Corey Huinker , Stephen Frost , Ashutosh Bapat , Matthias van de Meent , Peter Smith , PostgreSQL Hackers , Tomas Vondra Subject: Re: Statistics Import and Export In-reply-to: References: <54f190b6c757da2a33cce811949e9dd9601fcba7.camel@j-davis.com> <1632327b74a734f8c434eb75e824160d2b06a697.camel@j-davis.com> <16412b8b7ae443cb7470006beff3011927048860.camel@j-davis.com> <1b1bd1ec39ab3de09a17bf7b241021067e5bd63c.camel@j-davis.com> <2bce855db8259c5672a09f863a307ca07b967b68.camel@j-davis.com> <5e94c358caedf2a231dd71624c3578db7227a265.camel@j-davis.com> <4afa70edab849ff16238d1100b6652404e9a4d9d.camel@j-davis.com> <3df03aa65aa6ea3a76582e1a792e422dc5c32ad3.camel@j-davis.com> <718fa933c2c58d0ecc61995ab5c7ca1fe78d6369.camel@j-davis.com> <447200.1711819134@sss.pgh.pa.us> Comments: In-reply-to Jeff Davis message dated "Sat, 30 Mar 2024 10:29:43 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <473883.1711820380.1@sss.pgh.pa.us> Date: Sat, 30 Mar 2024 13:39:40 -0400 Message-ID: <473884.1711820380@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jeff Davis writes: > On Sat, 2024-03-30 at 13:18 -0400, Tom Lane wrote: >> Surely they are data, not schema. It would make zero sense to >> restore them if you aren't restoring the data they describe. > The complexity is that pg_upgrade does create the data, but relies on a > schema-only dump. So we'd need to at least account for that somehow, > either with a separate stats-only dump, or make a special case in > binary upgrade mode that dumps schema+stats (and resolves the CREATE > INDEX issue). Ah, good point. But binary-upgrade mode is special in tons of ways already. I don't see a big problem with allowing it to dump stats even though --schema-only would normally imply not doing that. (You could also imagine an explicit positive --stats switch that would override --schema-only, but I don't see that it's worth the trouble.) >> Maybe we need to revisit CREATE INDEX's behavior rather >> than assuming it's graven in stone? > Would there be a significant cost to just not doing that? Or are you > suggesting that we special-case the behavior, or turn it off during > restore with a GUC? I didn't have any specific proposal in mind, was just trying to think outside the box. regards, tom lane