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 1u07dr-00CQhI-6L for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Apr 2025 23:37:07 +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 1u07dp-000zOI-Rs for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Apr 2025 23:37:05 +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 1u07dp-000zOA-CH for pgsql-hackers@lists.postgresql.org; Wed, 02 Apr 2025 23:37:05 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u07dn-0033WW-0a for pgsql-hackers@lists.postgresql.org; Wed, 02 Apr 2025 23:37:05 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-7398d65476eso218520b3a.1 for ; Wed, 02 Apr 2025 16:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1743637020; x=1744241820; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=ISHrUMnt7dF2xgllTpmotVL3IETxUC0k1x5yr1eI1MI=; b=gzoY5vWT11gEpIh4W0aydzRZCR/ifNC9Y7+3kAeKcIawas9hNLlEZIqSjxBGDHNJ6u JbyZLIRMf1KCyMUZzumKUIV638HrEgBD0wUkUuqKcvQNVPCceLMJQZgKzuUfwd0Y8IPl 2bIkTxNpoW1iWHjD7TC3tZZQj/WI/vc6Ai8CuaLPjprytO1Qfr3VGOqfIJ7n9a1uqemU wa2hnSOlrIb1PvrHzoZBi5KpJhokKD24RV51r8Uz5XuWirY8j5zajroEN409UKZgrm0S EgCkMai9qks/T6InN5mv39nrfoee5Is6ZIbkmr9dGE25CZtfYN4bBX7kSIFyPM4xLl65 2B0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743637020; x=1744241820; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ISHrUMnt7dF2xgllTpmotVL3IETxUC0k1x5yr1eI1MI=; b=tvRB3aKcswYSoOffvJwnYx84Iqmcy8EOALI9RYHgZgqlMMFyVmEVVZD30VJZ8aAdq+ V2o8ylEgmaeqHRyVN+QjMGxbjUl6jztbGY9F3gW474tGEw1POZWqTWYiyBQziK4Isc5U TK8qeoJKz0QN8ZOuHWPpNFwfmJcpfKqE2qa1pGju2Par/7bt8ngUHZWoNCsLn2TDZ3td PZslNtzQwkvG17vKRM7qoJGGG7eVb33ne7nMWYQRr914RlIpOimEm8OfHksPV5H2iHcy 4YbEo3JnRJV2dm9sLoDVkM2tbAV29C5umVEbSisKCjeUS7Db3bZRaHoQ4XsEBF1VzoRS wphg== X-Forwarded-Encrypted: i=1; AJvYcCVEaPBshFA8Drf4BYTeC2dBZBx+aByhUMgTKcDpc8vE6wTOrNKkaangsxWFLcpUy94z7d+fkVGHcOKxvQdO@lists.postgresql.org X-Gm-Message-State: AOJu0YzlrMc+n2B3X7sJTYFaPq3+zH8vakH3OSbyeGAe/cWU7yvgbdqi WOAnlZuubxgOZK7LbXOGRzz6b5xRXttLOAmgXCBnD/n0xJ9pjV6KjJqxq1mP7w== X-Gm-Gg: ASbGncvXSzfLB3utN0OktEaOCuOLanZtij2Du9X/pszMJYdtUdfVs+TCe8J7SF0Im+7 Ytu5OX452KhzF2ZLQ5E/aKYqpGxvVz4a+IHf/D3nTbXU1huXblmjUHxFUqq9Da2QPX5QH/F5LXV LpuXhpkOKiPe7Rs9rZ/ZJMqutL6fghtnCdeAQH4uC2+GftDxSOidklRS6o51MStDYEoQD/HBmwh GOm8bCCdUv84RONZ9sJ+VT00fGtRRJjGb/vX1dneW4HRPoilav6rHomR+yzyJS+fYuqEknnNivc hvFY1XWQwMusZ+AZ/g2LaF5YUUMFrFQFulvgK92M4bA+HK8pPPFuMLsYL8SDEf77B1IGAVzpWGv 6da2XI/Sx9e42KFsgHIKP+vpS X-Google-Smtp-Source: AGHT+IE9NQTDN50EDSk8giq+k7pJB/+3FDePTlzG5GK7mnq0e4TAxlGrrIuRJB+TRIVJZljPPqH9nQ== X-Received: by 2002:a05:6a00:3983:b0:730:9637:b2ff with SMTP id d2e1a72fcca58-739d6392c69mr1666001b3a.7.1743637020541; Wed, 02 Apr 2025 16:37:00 -0700 (PDT) Received: from ?IPv6:2601:642:4c01:6dcc:95b2:852e:8da9:9a28? ([2601:642:4c01:6dcc:95b2:852e:8da9:9a28]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-739d97f2fd3sm106267b3a.69.2025.04.02.16.36.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 16:36:59 -0700 (PDT) Message-ID: <6f02786f4f303fe279963d1546e105762072a187.camel@j-davis.com> Subject: Re: Statistics Import and Export From: Jeff Davis To: Nathan Bossart Cc: Corey Huinker , Robert Treat , Robert Haas , Andres Freund , Tom Lane , Michael Paquier , jian he , Bruce Momjian , Matthias van de Meent , Magnus Hagander , Stephen Frost , Ashutosh Bapat , Peter Smith , PostgreSQL Hackers , alvherre@alvh.no-ip.org Date: Wed, 02 Apr 2025 16:36:58 -0700 In-Reply-To: References: <88af35fe0ff24cc4e0700b841aa60a0865f11648.camel@j-davis.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2025-04-01 at 22:21 -0500, Nathan Bossart wrote: > It certainly feels risky.=C2=A0 I was able to avoid executing the queries > twice > in all cases by saving the definition length in the TOC entry and > skipping > that many bytes the second time round. Another idea that was under-discussed is whether the stats commands should be in the TOC at all, or if they should be written as data chunks. Being in the TOC creates these issues with rewriting the TOC. Also, the stats can be fairly large, especially for a wide table with a high stats target, so the stats commands can increase the size of the TOC by a lot. But putting them in the data area doesn't seem quite right either, because the data is just data, whereas the stats are a list of SQL commands ("SELECT pg_restore_relation_stats(...); ..."). Also, if we went down that road, we'd have to consider parallelism, which might defeat the batching work that we're trying to do. Regards, Jeff Davis