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 1rsbKi-0085oV-7Y for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Apr 2024 04:37:44 +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 1rsbKg-000j8a-DM for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Apr 2024 04:37:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rsbKg-000ix7-0e for pgsql-hackers@lists.postgresql.org; Fri, 05 Apr 2024 04:37:42 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rsbKd-000gS6-FA for pgsql-hackers@lists.postgresql.org; Fri, 05 Apr 2024 04:37:40 +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 4354bWVQ1183620; Fri, 5 Apr 2024 00:37:32 -0400 From: Tom Lane To: Ashutosh Bapat cc: Corey Huinker , Magnus Hagander , Jeff Davis , Stephen Frost , 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> <3df03aa65aa6ea3a76582e1a792e422dc5c32ad3.camel@j-davis.com> <718fa933c2c58d0ecc61995ab5c7ca1fe78d6369.camel@j-davis.com> <790773.1711910899@sss.pgh.pa.us> <864345.1711932452@sss.pgh.pa.us> Comments: In-reply-to Ashutosh Bapat message dated "Fri, 05 Apr 2024 09:48:50 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1183618.1712291852.1@sss.pgh.pa.us> Date: Fri, 05 Apr 2024 00:37:32 -0400 Message-ID: <1183619.1712291852@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ashutosh Bapat writes: > I read that discussion, and it may be ok for pg_upgrade/pg_dump usecase and > maybe also for IMPORT foreign schema where the SQL is generated by > PostgreSQL itself. But not for simulating statistics. In that case, if the > function happily installs statistics cooked by the user and those aren't > used anywhere, users may be misled by the plans that are generated > subsequently. Thus negating the very purpose of simulating > statistics. I'm not sure what you think the "purpose of simulating statistics" is, but it seems like you have an extremely narrow-minded view of it. I think we should allow injecting any stats that won't actively crash the backend. Such functionality could be useful for stress-testing the planner, for example, or even just to see what it would do in a situation that is not what you have. Note that I don't think pg_dump or pg_upgrade need to support injection of counterfactual statistics. But direct calls of the stats insertion functions should be able to do so. regards, tom lane