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 1tw9VH-00BDwp-4F for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Mar 2025 00:47:51 +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 1tw9VF-005ttY-Pv for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Mar 2025 00:47:49 +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 1tw9VF-005ttQ-GE for pgsql-hackers@lists.postgresql.org; Sun, 23 Mar 2025 00:47:49 +0000 Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tw9VD-000afO-1W for pgsql-hackers@lists.postgresql.org; Sun, 23 Mar 2025 00:47:49 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.stl.internal (Postfix) with ESMTP id D842611400E9; Sat, 22 Mar 2025 20:47:45 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Sat, 22 Mar 2025 20:47:45 -0400 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=fm1; t=1742690865; x=1742777265; bh=LM17ft3n6K Y4K3yGFPZfJqO8snn1zxSeubi4tzYzCqE=; b=VfcaATigUi+MMDvb4MY7/9jM7q y9RmsnPyLlBIJQYKlxmFSwoMZIoYKfmmhvqOYMNpFRvzgdTznhrRyRLLabPjC+zE EiaNOvKRqInar8HDueBsAzwptPmAo4s2lRUzuw6xy7N+MaKR0HX2KHdwYG5BIDj6 ccpbKXBO3Ob8qB+camH1dUIeFfh6F1ScL2PzmRicDLUA8AkJ2HTMmb88nP1y2Kh7 6sOAVjG2i/M52Cw41DWrd0yjR3eiO4J2NKu33j7zvTHQ7s+aeh1DsPCVTTFXaPvZ v1u0JqQgLOL/P8SCejRBnPJUDxvOMjSJwxt3hYmXlhJuFwpkJL9JQsjkXqYA== 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=fm1; t= 1742690865; x=1742777265; bh=LM17ft3n6KY4K3yGFPZfJqO8snn1zxSeubi 4tzYzCqE=; b=Mf3l3GuefaJwF6EbMx3Z1ozAPuI5gpZfZXjZpsffQw8CaeL6SjL eSWEN3CaEb0Nn7e2C7eK0jQ5WKS0MBQ2FoCjICmhEeiZI/8M//xF2ogtK9xu+rUt Y0UaO/nnRHbIBzBeqTT36WMRFyJdUjm1YjWBphgcOah+0Vul03GRwGuIYbpIV8Sr Lp10b/YMaccVyRdy+ifCBnxk2tDXnCiAaNvxHsD6nA3nloiixp2rcEM01mwH+Z2W oTatVvyDk28jBcCDVoT5ctZGanCxsy4zsv7A7qGVtI4A/DWHVOu1qMFz9lZw3Blw WeKvE5l9Wcrc3tlrmCSZzIKADwXeRZzhgAQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduheehgeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefu kfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivg hruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhep teelieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggv lhesphgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtph houhhtpdhrtghpthhtohepthhglhesshhsshdrphhghhdrphgrrdhushdprhgtphhtthho pehmhihonhesuggvsghirghnrdhorhhgpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvg hrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepmhgruddt tdeshhhothhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 22 Mar 2025 20:47:43 -0400 (EDT) Date: Sun, 23 Mar 2025 09:47:31 +0900 From: Michael Paquier To: Tom Lane Cc: Christoph Berg , PostgreSQL Hackers , ma lz Subject: Re: query_id: jumble names of temp tables for better pg_stat_statement UX Message-ID: References: <1831838.1742656359@sss.pgh.pa.us> <80506.1742660683@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ztQF9c1hKb9FC1iU" Content-Disposition: inline In-Reply-To: <80506.1742660683@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --ztQF9c1hKb9FC1iU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 22, 2025 at 12:24:43PM -0400, Tom Lane wrote: > I experimented with this trivial fix (shown in-line to keep the cfbot > from thinking this is the patch-of-record): >=20 > What's happening there is that there's an ALTER TABLE ADD COLUMN in > the test, so the executions after the first one see more entries > in eref->colnames and come up with a different jumble. I think > we probably don't want that behavior; we only want to jumble the > table name. So we'd still need the v3-0001 patch in some form to > allow annotating RangeTblEntry.eref with a custom jumble method > that'd only jumble the aliasname. Alias.aliasname is not qualified, so it means that we'd begin to assign the same query ID even if using two relations from two schemas depending on what search_path assigns, no? Say: create schema popo1; create schema popo2; create table popo1.aa (a int, b int); create table popo2.aa (a int, b int); set search_path =3D 'popo1'; select count(*) from aa; set search_path =3D 'popo2'; select count(*) from aa; =3D# select query, calls from pg_stat_statements where query ~ 'select count'; query | calls -------------------------+------- select count(*) from aa | 2 (1 row) Perhaps that's OK because such queries use the same query string, but just silencing the relid means that we'd lose the namespace reference entirely, making the stats potentially fuzzier depending on the workload. On HEAD, one can guess the query ID with an EXPLAIN and a search_path, as well, so currently it's possible to cross-check the=20 contents of pgss. But we'd lose this possibility here.. -- Michael --ztQF9c1hKb9FC1iU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmffWiMACgkQnvQgOdby QH0BdQ//fH5EkcDcwyL17hgB1hTPEUxrOpHji19mgjbcAVj4bPX+AE8iIE3uhDuY QK/8XuOsJMK2vIlva6rKUUHqCqcNlqG24O2PL0oF6KjbGq3zHaXRgxIjvchLTnrx wIZ0EaMTGA2bKQ7ch9jgAqGRYKA+9udr4JIEfCz/EeiomdtCDq2qTBnArNA5mbZG HOY8sUc5ZW0AUJUN92TKHjzofIwe9YzuzzNWCDfA8T6rIUfioNmZ/w1VsLG+t2Yv w9TxQC8J3tFF83LekjX9+VjnODFPKvdqhvcNOgXXr7SdzLJSPhrqNPFfr557iQ0C bf9MYKvulWofUEzEl4hYRcFpq5nrFkWAy/NkdqzsrGlsaMt4hnvRn4zPiB3xVfG7 NACpQplueIJ+ZC0y4Pq2O1hxQ4lxvJMPZsWsJ9SkIKhI2gnfzPAi6xr+4zkdcGCI mXO4LOhqL7YheEXzKHOSsfSLNctZJuKi/zzuLVf0qXEXbAg32Uxm0CxFvlUETSaS RIDnuxkGN6HeLsY6wNdmTZdv85cPiI80NBwIrSAYJh5y8JIW3rGKCeIJpM/VTJN3 QZB4yEVNTEVzT3TDLv3n4x+iaY1bBZ6KKjjcIiAUw1MqJ/CoSSjbefvk8oJND063 X3FfU22UCanKLWHteS3PrK7w4w4cqALCxq4w99CeJb2bL9NDB0Q= =VENE -----END PGP SIGNATURE----- --ztQF9c1hKb9FC1iU--