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 1tiPTM-00Fg2F-3p for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Feb 2025 03:01:04 +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 1tiPTK-000wlY-2N for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Feb 2025 03:01:02 +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 1tiPTJ-000wlQ-L7 for pgsql-hackers@lists.postgresql.org; Thu, 13 Feb 2025 03:01:02 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tiPTH-000XYh-1u for pgsql-hackers@lists.postgresql.org; Thu, 13 Feb 2025 03:01:01 +0000 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2fbfa8c73a6so835822a91.2 for ; Wed, 12 Feb 2025 19:00:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1739415657; x=1740020457; 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=RvMRMVFHmMjp6u+h6xGOqEKovMDQD3YU7k1DIH3Yx6A=; b=3GHkcGS2hITCUGQJbCmUFdvZHlpbI3y8XmzJYyJ8co1bo8oA0uMB1LdER6Yq/UDDKc VCGl8yHCxFZgjjutk/sc6cajGIo57SElPT64liJycLAYC2gUkJ4CTJkYHvhKmsL/FvXJ QDsg7S0PGUnuuGvq1oRG+rsv1QA41CUkPG66REqf7K3zxPQ59fZtvcZa3ZtJjB1mmtsj 2qZ1/gOgeXJr8vbJI/lq1ZTEDvqJ/DiqiX+JVHI/ShedElVtOgN7DkLKveAT1KwZG+Sj QEUyGFADShx1sFyOZFK+hW97vEAH1yg9sZ+FbgMlWctWGliPFU3fqNY6h/KgsbENDC7A usbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739415657; x=1740020457; 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=RvMRMVFHmMjp6u+h6xGOqEKovMDQD3YU7k1DIH3Yx6A=; b=H3t/yR4CvG/2WQYotciG9i4H03IQ1cn614ErGx5JN3PnjBp8tzv5gTcfHVjIS6h6J0 huFOn7W3UbaCnxLIY23ZSFtdkwlgWnlF3kEj6SWS84fBuqSSN391gz03M5wdI2iTEhE0 K10VlHHr/fDLt6MnCxeiCiV0UBMy6SVh1pJ4fvbIAVeC9VamNj+hwwe2Nol8iVw6Vdys OjbtLP4ynx87bUq+T/wqbxedoXRGt8t2Ta+XyIRR5esZR9+Tu+jvwYRryW/aHMp2n2wY JgQqUZzmiWpM6tiU88aKr1QSNfgkL7XQrkOgnKxPVGTbYqnYCp6/aeXEq0PaipAXeaVx OFKQ== X-Forwarded-Encrypted: i=1; AJvYcCWmhFcL+C+BPCm3Zh75iKK8G9qWlJ74MuxsgaK6rQaPk+Xa6PZznwHS4djk39x5NVZlkiyBwlzgahlkieIn@lists.postgresql.org X-Gm-Message-State: AOJu0YxBo6EqGNAx1Z3mnOtrnnHUNzIBwYjU9UC/OzJ9WHHU9MBSW91m m10gZ4/3ZNgGQ6zOlwQAXP6uWOdHp8zRKgj732XkiKALeXje2aemI+xVND+Ftw== X-Gm-Gg: ASbGncukDS1Y18sRSeQsk27PG1z2/9CH80yZEXgsCftZbQrglfYtXZ2uyI291mWxIZo u6RKbD/dy+zqsN0E7/G+E76N5JRIhgvS816JyCGFmNoRrroRN3rXYFsRwUV91L3DdIofUR+AMbk DD3lyFqDzNJBekBbvMhOnW48xCtGkg48Str6oYx3NWneiiU/52o3CJhftMqk8RahHhGMdZ0Xzou kiRDHOVadKfUQgUnCGSBAXLL6QgaxOT1X4YL/FXT4l8W42SnHqO41Mqw6bvxRdlvQvIdHr8DAQ0 j/EBbnKU1ulcHnA= X-Google-Smtp-Source: AGHT+IHr4HRv1LHCDa6vJe69aIk5FeVWeoCYp6jGNOslmdmlu61zv/Trz7Btqm4A6+5ZSTusF8iNdQ== X-Received: by 2002:a05:6a00:ab8d:b0:732:1eb2:7bf3 with SMTP id d2e1a72fcca58-7322c41772cmr10477402b3a.21.1739415657207; Wed, 12 Feb 2025 19:00:57 -0800 (PST) Received: from [172.18.5.10] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7324277b09bsm175013b3a.157.2025.02.12.19.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2025 19:00:56 -0800 (PST) Message-ID: <26e55538fa8c47d660642f367cd8a19333420789.camel@j-davis.com> Subject: Re: Statistics Import and Export From: Jeff Davis To: Corey Huinker Cc: Michael Paquier , jian he , Nathan Bossart , Bruce Momjian , Matthias van de Meent , Tom Lane , Magnus Hagander , Stephen Frost , Ashutosh Bapat , Peter Smith , PostgreSQL Hackers , alvherre@alvh.no-ip.org Date: Wed, 12 Feb 2025 19:00:55 -0800 In-Reply-To: References: <0b4c098ae3968aa23d6accb691f47bdba143aedd.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-02-11 at 14:02 -0500, Corey Huinker wrote: >=20 >=20 > The previous 0001 is now committed (thanks!) so only one remains. > =C2=A0 Summary of the decisions made in this thread: * pg_dump --data-only does not include stats[1]. This behavior was not fully resolved, but I didn't see a reasonable set of options where (a) --data-only would include stats; and (b) we could specify what pg_upgrade needs, which is schema+stats. Jian seemed to agree. However, this leaves us with the behavior where --data-only doesn't get everything in SECTION_DATA, which might be undesirable. * stats are in SECTION_DATA[2], except for stats on objects that are created in SECTION_POST_DATA, in which case the stats are also in SECTION_POST_DATA - indexes are created in SECTION_POST_DATA, and though plain indexes don't have stats, expression indexes do - MVs are normally created in SECTION_PRE_DATA, in which case the stats are in SECTION_DATA; but MVs can be deferred to SECTION_POST_DATA due to dependency on a primary key * SECTION_NONE was proposed, but rejected[2] * The default is to include the stats.[3] * pg_dump[all] options are designed to allow specifying any combination of schema[4], data, and stats: --schema-only (schema), --no-schema (data+stats) --data-only (data), --no-data (schema+stats) --stats-only (stats), --no-stats (schema+data) * A SECTION_STATS was proposed and rejected due to complexity[5] * The prefix in the dump output will be "Statistics for " (instead of "Data for ")[6] * The TOC description will be "STATISTICS DATA", differentiating it from an extended statistics object[6] * pg_upgrade will now pass --no-data (schema+stats) to pg_dump instead of --schema-only, thereby transferring the stats to the new cluster[7] It's been a long thread, so please tell me if I missed something or if something needs more discussion. I'm still reviewing v48, but I intend to commit something soon. Regards, Jeff Davis [1] https://www.postgresql.org/message-id/b40b81d38c3a87fdef61e4f7abfbc7f27c7fb= cd9.camel@j-davis.com [2]=20 https://www.postgresql.org/message-id/1798867.1712376328%40sss.pgh.pa.us [3] https://www.postgresql.org/message-id/3228677.1713844341%40sss.pgh.pa.us [4] https://www.postgresql.org/message-id/CACJufxG6K4EAUROhdr0wkzMh5QyFLmdLZeAo= h7Vh0-VbuAtHcw%40mail.gmail.com [5] https://www.postgresql.org/message-id/3156140.1713817153%40sss.pgh.pa.us [6]=20 https://www.postgresql.org/message-id/d8df5339cab25b5720667beaaed8a8bb8e115= 78c.camel@j-davis.com [7] https://www.postgresql.org/message-id/c2bc08dfec336c03f7a7165d1347e2b52cf98= b17.camel@j-davis.com