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 1twxTy-001MGa-7Q for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Mar 2025 06:09:50 +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 1twxTv-00GawH-Ib for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Mar 2025 06:09:47 +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 1twxTv-00Gaw9-7B for pgsql-hackers@lists.postgresql.org; Tue, 25 Mar 2025 06:09:47 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1twxTs-0011Ce-2d for pgsql-hackers@lists.postgresql.org; Tue, 25 Mar 2025 06:09:46 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-549b116321aso5550373e87.3 for ; Mon, 24 Mar 2025 23:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fittl.com; s=google; t=1742882984; x=1743487784; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8JA3uRkohbXMGrP+xcf+dZ5tbj0hmwXZRylsxgsVCv0=; b=l8OeG9+dmbaKjsvHHLTB/8ctOYcFO7IFFpWNDQ+13evmRE2jSyvIeoN6VOTdTDVbEO 3D6x8Igh9Qslwav0/Hy1JqhlbbfR9nbOzK9MkWenL96N8KRRnnJiTXSTyJrxVLIWhWmu TA//FoLTUXOjzwUmDS/LN35MRvn8QlNQMImfw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742882984; x=1743487784; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8JA3uRkohbXMGrP+xcf+dZ5tbj0hmwXZRylsxgsVCv0=; b=VTcb5TeaLAqJS8qW9RRaCLopsNEYQxHX/GxRLRPeUnnAhnqyNUgRFYh8Ire+Xk6Xyx 7gkbgGVRlFHu/cSusaujdbz/DcglN2VpbNK4HNyhR1Zg2IFbL/eNzpCe9PyU+2JMEcX6 ZdGVmXeSoE0j3swE28m41HvWfKpNQ/VPMxpbUnj99uXYkG83djvSYM0ZmTTEq3Ui0obE GimwCoKUTwTQB1/Jjz0a72mjdLPPAiT8Wdd8SHnfQObVDVmoVZFu+Rh+e9Iulkmi2Yyh TNXx1eGD7hIgsXhMlZOCQMvPAopL/1vjIhJ26lNkh6AsUgRfu9AZCXB9u7UmavE4GeMo VgVA== X-Forwarded-Encrypted: i=1; AJvYcCXFOStkuNQddv9j4bkmrckjNXv41mQB/eiohjm9Rj5Wvku15Elg7sSXDALGSXgQfusIfYbWRb6w3fC+Os2b@lists.postgresql.org X-Gm-Message-State: AOJu0Yz47zJXBRLdxP3UMefoiT6vyqMs7aL53S0B/dR3ZZYtAFWPynGB lwZFsvY2Z303l0y16YzLcG/GG93nnh8y6Aehd/UHuzeQcHMBMNuZOi20RvOvFFYdX5ekJLpkvbG 3v3M82h/nG2SeudWUrXgRdJcphBPDLUORmt/2 X-Gm-Gg: ASbGncuYqXb5WxdQpZF5PiLtM7ESCASd1mrfeswtZfYRfwoUk9O6l7YzzDildHGkcw+ FQlFW/I/NPGaHaO/D32mbIXtxx4Ptr32EgGbMD/CNKIoaZPw3MxOYeCzHD197Gu4y2AAKH0Yq2Z wR/dTg2mmydqfM/EhoLfjb9nSJqDw= X-Google-Smtp-Source: AGHT+IFfiG+YDSePlOpUOYzd02nu6vG7VQhgY6+/X4ATT2Powe1Wih2t1lVmoEApoiPcLOd/+tmpKgjv025ks2I2LMk= X-Received: by 2002:a05:6512:3b9d:b0:549:5b54:2c77 with SMTP id 2adb3069b0e04-54ad64f587amr6432680e87.32.1742882983532; Mon, 24 Mar 2025 23:09:43 -0700 (PDT) MIME-Version: 1.0 References: <1831838.1742656359@sss.pgh.pa.us> <80506.1742660683@sss.pgh.pa.us> <461405.1742691859@sss.pgh.pa.us> <1189112.1742869660@sss.pgh.pa.us> In-Reply-To: From: Lukas Fittl Date: Mon, 24 Mar 2025 23:09:06 -0700 X-Gm-Features: AQ5f1Jrbngqks86bNBvn4YS4ga9JJ7eEn0cK7-4kY20eznS8h1yfR9weOVgJ9lk Message-ID: Subject: Re: query_id: jumble names of temp tables for better pg_stat_statement UX To: Michael Paquier Cc: Sami Imseih , Tom Lane , Christoph Berg , PostgreSQL Hackers , ma lz Content-Type: multipart/alternative; boundary="0000000000001e75ab06312491ac" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001e75ab06312491ac Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 24, 2025 at 8:51=E2=80=AFPM Michael Paquier wrote: > On Mon, Mar 24, 2025 at 09:38:35PM -0500, Sami Imseih wrote: > > > select * from foo s1; > > > select * from foo s2; > > > > ah, thanks for pointing this out. Not as good of a workaround as > > a comment since one must change aliases, but at least there is > > a workaround... > > Exactly. Like Tom I'm not really worried about the proposal, but of > course I could prove to be wrong. I am ready to assume that bloat in > pgss entries caused by temp tables is a more common case. > For what its worth, +1 on the current proposal in this thread (and doing it without a GUC), i.e. merging a query that references the same table alias, ignoring different schemas. In the context of the earlier referenced one-schema-per-customer workloads: In my experience these often not work well with pg_stat_statements today because of their own bloat problem, just like with temp tables. You quickly have way too many unique entries, and your query text file accumulates a lot of duplicative entries (since the same query text gets repeated in the text file, since its queryid is different), to the point that you can't monitor your workload at all anymore. Thanks, Lukas --=20 Lukas Fittl --0000000000001e75ab06312491ac Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Mar 24, 2025 at = 8:51=E2=80=AFPM Michael Paquier <michael@paquier.xyz> wrote:
On Mon, Mar 24,= 2025 at 09:38:35PM -0500, Sami Imseih wrote:
> > select * from foo s1;
> > select * from foo s2;
>
> ah, thanks for pointing this out. Not as good of a workaround as
> a comment since one must change aliases, but at least there is
> a workaround...

Exactly.=C2=A0 Like Tom I'm not really worried about the proposal, but = of
course I could prove to be wrong.=C2=A0 I am ready to assume that bloat in<= br> pgss entries caused by temp tables is a more common case.
<= div>
For what its worth, +1 on the current proposal in t= his thread (and doing it without a GUC), i.e. merging a query that referenc= es the same table alias, ignoring different schemas.

In the context of the earlier referenced one-schema-per-customer=20 workloads:

In my experience these often not work w= ell with pg_stat_statements today because of their own bloat problem, just = like with temp tables. You=20 quickly have way too many unique entries, and your query text file=20 accumulates a lot of duplicative entries (since the same query text gets repeated in the text file, since its queryid is different), to the point t= hat you can't monitor your workload at all anymore.

Thanks,
Lukas

--
Lukas Fittl=
--0000000000001e75ab06312491ac--