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 1tnLjk-004SyL-FO for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Feb 2025 18:02:24 +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 1tnLji-00AecX-RQ for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Feb 2025 18:02:22 +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 1tnLji-00Aebb-CN for pgsql-hackers@lists.postgresql.org; Wed, 26 Feb 2025 18:02:22 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tnLje-000F4V-0R for pgsql-hackers@lists.postgresql.org; Wed, 26 Feb 2025 18:02:22 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-220bff984a0so247315ad.3 for ; Wed, 26 Feb 2025 10:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1740592936; x=1741197736; 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=MzrHake1rg4lOWYqDzXZOU6UwBpyGnaxR/nrGKR8myY=; b=3ZL2aCU6M5PPnVZHrWrOzlCdSGgufEYiNAvSODyO2+TszRHWXsxCYOBu+kNIESyGCw XLtM14hf/NZlg3wGp/oO3kB3D4D7pDVBq2AU0uF40WYzNRmWFCxnjGIc0yHbJu0OQBXQ fIliGJFMR8tMhqaKhHtkwLRaKeHOXpd2TRqfMThQxsJ/Oq/wYCNlUlO10N2mm4gP9XAX +t2ABRuCACJL4eDC3cXEvrV+PXUECat64o7Bw7POpPY8dL7OWSnf2sL1HUpfUFgN8zjN zmFxb9qTffHOrOBuc4ETm6IkLnjDsOTHh91GxEkodzSKc/zhCY/lMJwN1IIhqB9nCwn6 euTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740592936; x=1741197736; 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=MzrHake1rg4lOWYqDzXZOU6UwBpyGnaxR/nrGKR8myY=; b=dlSFIyr+G1mtW3mOeoJP4qZdK0T3a1t6jZkCNIzanO1vGvzr1vjvu2Wd8pxmQWfQWJ Yel9Blpv9lF/0HtfLTH/a5rKhNVafpMqXcXiJUjV3m6Y4Tih/Qt/mSIZnX3stx28Dgm5 wvslmd3F02mhIrOZ0z67N0Gd+9NvSkQ8Catz/uxkLBKJIckzdVdAP8sMX6kkY2KAZguv SsNe0lT4QE4jU+k+zR9NMM3RxJkgI31gZd+jVjxGTPMzVyy4mGFx9zr1n6kGOuaoHl5m rblS8ZEZs0M/1GRWiJHIWQthJnFdNrIAbPGElZfu8TQzJ/Ch6U/+YWoPy1pgtNhqE2w1 Njsg== X-Forwarded-Encrypted: i=1; AJvYcCXpBdV1iA6eGnkMqPdcG53E2sIPxYA13CpI2UJWXb1M1EPZKn9Xyej5o1OieihlAUHDkN8ywm7M/3UwOC2w@lists.postgresql.org X-Gm-Message-State: AOJu0Yykyq2LRCRVsDxcBMYC19iPdWZnCWsTASdeX6ezC9epDn4wfgrD BvcW/rua0x1cism2pmd6WxtWOz9CFvWrox0DrSQirKTAsCkjcF9LJYBo6ex34w== X-Gm-Gg: ASbGncv8WlJ0Y7MSrK4XcIULQbUpR8ejlyIv1qXjx19n3SXmJeWuPmyqRdcAuED4bDc rVCMOW8HIRn4vgxpDe00TO7uP/uWugUf37+Wjhf5r0AGzbxnl1jASgX0d/9oPW3FCCayDZWjeNV oo6n9f2whvKSWaIcHNjb1JLsgp3nm48yhc446drELmCet0xw4qWdsTpXlhbeHYsLW5RRot0BvWx rFMc8b2u5+uQdQ8z/Hf1jM9g/GrrDzI47FsANzp76Kz0IJMamqYbHfe0wwg1TWwtklztpidvbYk f8Eufa0/JB5HwgbpGl1RB4qiNP20zFUQyxHTS4XNv9DOVrhYXf3h9GxLX2xV8WnkDMRX X-Google-Smtp-Source: AGHT+IH8lN/XmXogZGGMRo4LcuwAM7nndiYb5/CtYrfUCH+jLqWZ/9gO0da7RJb5wTwRFudPHGMQ0A== X-Received: by 2002:a17:903:2284:b0:21f:3e2d:7d36 with SMTP id d9443c01a7336-22307b32c1emr136458015ad.1.1740592936267; Wed, 26 Feb 2025 10:02:16 -0800 (PST) Received: from jeff-laptop.lan (c-76-102-242-158.hsd1.ca.comcast.net. [76.102.242.158]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2230a092fc9sm35650295ad.126.2025.02.26.10.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2025 10:02:15 -0800 (PST) Message-ID: <51fca6b6c0032d28e053ad89f7e858e2a9e498af.camel@j-davis.com> Subject: Re: Statistics Import and Export From: Jeff Davis To: Corey Huinker , Tom Lane Cc: Andres Freund , Michael Paquier , jian he , Nathan Bossart , Bruce Momjian , Matthias van de Meent , Magnus Hagander , Stephen Frost , Ashutosh Bapat , Peter Smith , PostgreSQL Hackers , alvherre@alvh.no-ip.org Date: Wed, 26 Feb 2025 10:02:13 -0800 In-Reply-To: References: <3670503.1740173078@sss.pgh.pa.us> <3728741.1740178078@sss.pgh.pa.us> <97b451228227c555be1a4f79c4a62ddec9a74f06.camel@j-davis.com> <6af48508a32499a8be3398cafffd29fb6188c44b.camel@j-davis.com> <1698502.1740541206@sss.pgh.pa.us> <1704472.1740544569@sss.pgh.pa.us> <1707557.1740546344@sss.pgh.pa.us> 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 Wed, 2025-02-26 at 04:25 -0500, Corey Huinker wrote: > 0001 - Add attnum support to=C2=A0attribute_statistics_update >=20 > * Basically what Tom posted earlier, minus the pg_set_attribute_stats > stuff, obviously. Should have a couple simple tests. And I would use two different error message wordings: "must specify either attname or attnum" "cannot specify both attname and attnum" (or similar) The "one of attname and attnum" is a bit awkward. The new struct for pg_clear_attribute_stats() isn't great, but as discussed we can get rid of that in a subsequent commit. Otherwise LGTM. > 0002 - Add attnum support to pg_dump. >=20 > * Removed=C2=A0att_stats_arginfo > * Folds=C2=A0appendRelStatsImport and=C2=A0appendAttStatsImport > into=C2=A0dumpRelationStats=C2=A0 Can we add a test here, too, to check that tables dump the attname and indexes dump the attnum? Everything else in the file uses i_fieldname =3D PQfnumber(), but in this patch you're just using raw numbers. Some of the fields from pg_stats are NOT NULL, so we could consider issuing a warning in that case rather than just skipping it. And it could use a pgindent. I ran a quick measurement and it appears within the noise of the numbers I posted here: https://www.postgresql.org/message-id/6af48508a32499a8be3398cafffd29fb6188c= 44b.camel@j-davis.com Regards, Jeff Davis