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 1vHVOO-009Zub-9s for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Nov 2025 22:57:16 +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 1vHVOM-00Gzlg-UQ for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Nov 2025 22:57:14 +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 1vHVOM-00GzlW-BO for pgsql-hackers@lists.postgresql.org; Fri, 07 Nov 2025 22:57:14 +0000 Received: from fout-b5-smtp.messagingengine.com ([202.12.124.148]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vHVOJ-006ZDi-2I for pgsql-hackers@lists.postgresql.org; Fri, 07 Nov 2025 22:57:14 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id CE57C1D00160; Fri, 7 Nov 2025 17:57:09 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Fri, 07 Nov 2025 17:57:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1762556229; x=1762642629; bh=pE9RQNI2vR DuCq82mycTEt/0GOrG6XQbqq0oA2YC4a0=; b=SSBib/SLnBHipUZ2AMuFj7EcWo 6wu9Hgz9J79GOgrE4AcJ/4fHPLLQP77mv3sKkWoxMEeOPGcbZw+knNVyqo9omQfn mlz5mjhacHnrg8NlJP1xm9yTjbJwf3LXTCF/NytIqc1UKgGAPrxcP2Ehf0KVNHKY u104ZzId3AcJMmSjpx2BKW3PFhawEZ+m18q3Zl7v7SA0qvn4SUYfVPUiO1Fdxt2n p5GtOzIH14G15XztFrq7GKSHfo2mICzykn/T5KeKdYcwoTQ0ldzLhKBaM4nlaTks CN85pN+XtJ9e0NNELWrO/r7nlWO7NaJcK2bQQchhHsACE6lZ3wUAD2GrPpEQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1762556229; x=1762642629; bh=pE9RQNI2vRDuCq82mycTEt/0GOrG6XQbqq0 oA2YC4a0=; b=10hJMHAEG0AB0yMmuZT4qQap+u0sHQwb+cLQ7/wrQkMu2yRGx6Q NITwp6ODq7eJfGil+0WHIv8o0JdnIufAZ5GTJVCfW0tvuHmoaisUDn/eYKmpuwnr q3AXAR4x6cM0MxOBSdZlJ6zEVi4cssuJvyJz0tQ2Bt9FYXBXGpb8J0kMfTHAG3d/ k6L/kIGzusFbH7sfS8kQOJ0qyGK24CH/P6NFxPvnviEK6q3NZ6askd8UZHWrhVlO 2Q1VrMjL5N8IE0zHOUF++ScrhKCcKoCZ2vzICYwCajKTv02fcGwvWf62qZ7qPvDj pHEWGWzE/nDop/RPgncO9Di+oWwkk4fjLJA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduledtledvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheptghorh gvhidrhhhuihhnkhgvrhesghhmrghilhdrtghomhdprhgtphhtthhopehtohhmrghssehv ohhnughrrgdrmhgvpdhrtghpthhtohepjhhirghnrdhunhhivhgvrhhsrghlihhthiesgh hmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhs rdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehtghhlsehsshhsrdhpghhhrd hprgdruhhs X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Nov 2025 17:57:06 -0500 (EST) Date: Sat, 8 Nov 2025 07:56:48 +0900 From: Michael Paquier To: Corey Huinker Cc: Tomas Vondra , jian he , pgsql-hackers@lists.postgresql.org, tgl@sss.pgh.pa.us Subject: Re: Extended Statistics set/restore/clear functions. Message-ID: References: <439a9947-e6a1-4ea9-84d8-1f843deaf6b1@vondra.me> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LOl6phV8B9YeVnZK" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --LOl6phV8B9YeVnZK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 07, 2025 at 05:28:50PM -0500, Corey Huinker wrote: > I'm open to other formats, but aside from renaming the json keys (maybe > "attnums" or "keys" instead of "attributes"?), I'm not sure what really > could be done and still be JSON. I suppose we could go with a tuple format > like this: >=20 > '{({3,4},11),...}' for pg_ndistinct and > '{({3},4,1.00000),...}' for pg_dependencies. >=20 > Those would certainly be more compact, but makes for a hard read by human= s, > and while the JSON code is big, it's also proven in other parts of the > codebase, hence less risky. I've liked the human-readability factor of the format in the current patches with names in the keys, and values assigned to each property. Another thing that may be worth doing is pushing the names of the keys and some its the JSON meta-data shaping the object into a new header than can be loaded by both the backend and the frontend. It would be nice to not hardcode this knowledge in a bunch of places if we finish by renaming these attributes. > A part of me thinks that everything that remains after removing > in/out/send/recv is just taking a table sample data structure and crunchi= ng > numbers to come up with the deserialized data structure...that's in/out > with a different starting/ending points. >=20 > There's no denying that JSON parsing is a very different code style than > statistical number crunching, and mixing the two is incongruous, so it's > worth a shot, and I'll try that for v9. Yeah, right. Thanks. The parsing pieces seem like pieces worth their own file. > The functions in question are needed because the exprs value is itself an > array of partly-filled-out pg_attribute tuples, so it's common to those t= wo > needs, but specific to stats about attributes. Maybe we need an > attr_stats_utils.h? Hmm, maybe. I'd be OK to revisit these structures once we're happy with the in/out structures. That would be a good start point before working on the SQL functions and the dump/restore bits in more details. -- Michael --LOl6phV8B9YeVnZK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmkOeTAACgkQnvQgOdby QH3o3A/9EQOUw4bt3mIfg6xWNp+/cVhRPj5krB08dP/RcN4fmO3/eLZH6/ezZpKT uwn02Bbad1Q+3owB12I2huZ7Zwt4yj0dwx6PbwZYlMk+R3ih6TGhZyZw6P47Rbw7 xVggfy2uCbdqiB10//DMvzOML+P5sgRlaCH+FtIDxU9vQHScQHsh0/93Z4ZBRS/S IITfQ8pDPN61cCDLeliXv2J1I+QZDcUFKz5fSKziFZVnWaFf18h+t3U48aP4NNmb +YNPPr1PVC2wMlXj4Al43uxawWbUbaT9j/EXZWdGs2LsC33Nb8khXUNaUCC0qB6n ngFDQhbhU0yih92PsXi6E70VVAExDRb5fgo4XELeLGc8jLT/vnBz6+FhTXuN5+/a S0mVGE7U2RLyTe3vREQgld16HVfkHInp7ca+JR24n0WKJTd++AgzlI+Pv4wTClHG kbjo3Mco3DirhNVBx6LgArvXsuu1QCgT1ij2vXvoVMzHMMHoF2Cpzrs8Gu/nGifX G1LbXspS1bylhPvVsU1KVCvJ9bDY6mSiFaLqk1hzTBT0NVNa68wYbK1TXpidfrLh a32JiKJwllNbdLhNpbz7kcZtWRwT9osrQDmevIjSXYKbDmBF0RFlVfngFXYepjOv Ua6mfdCIPp4+5Zq3ZK/fW4QLfoJqZa2Ap5PAnreiTDhADAMpT8U= =4uIo -----END PGP SIGNATURE----- --LOl6phV8B9YeVnZK--