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 1ucGpR-00B0n0-V0 for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jul 2025 05:06:46 +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 1ucGpP-00GTng-2P for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jul 2025 05:06:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ucGpO-00GTnW-Nz for pgsql-hackers@lists.postgresql.org; Thu, 17 Jul 2025 05:06:43 +0000 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ucGpN-007hcO-0d for pgsql-hackers@lists.postgresql.org; Thu, 17 Jul 2025 05:06:42 +0000 Received: by mail-qt1-x82a.google.com with SMTP id d75a77b69052e-4ab554fd8fbso15266781cf.1 for ; Wed, 16 Jul 2025 22:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fittl.com; s=google; t=1752728800; x=1753333600; 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=vcWpggG00DllBLePAO42TS+C8IjmZ6Hd8f4kK98YMBk=; b=aCf6WgAE0lzv1JHokF4fgLNwziXe2Tsng3/6rIBcJJrMG4GGBuWJ9l63Slc0AhrYtU mV+teXFYbsIVriHh4JmDYoUs2DlxEhZZ+i6dryKDD3Oik5UqEizupcAzoM6ujfEab4LE cZIqdDaZMlrOFTDTmdKO0C/wtfQwZOEK55vqA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752728800; x=1753333600; 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=vcWpggG00DllBLePAO42TS+C8IjmZ6Hd8f4kK98YMBk=; b=JftJdd6iIJgd3IrtR39XjYHrLEnE6i1qIjPKI0IiIQTYmpS42mP5m9JbfQag7MTbaw 38dwOjbu7V6+D3pX+/6JbI9iCkDuJo8zWblBtQ3U3yShbcg+QnxesM/Z2YhGu6pDepCS Paob61VSUlVnqOJKH7YGyWQWo+p/b72kv+yioBGaf5NRAg2dE/pQ3ay3vtO+qrWuN1wU xvh+h1mxb4lavUNIYi6LeyzBXEqLnZ9N3DFhQSZDorfKMRLGmoeMu13uYgJEsNC96CzK k5GX/1muz/QN6vcYh/YqV8IotcJrbygLdWhf1QLUKRHzAc4obCIzcKi4j9bx9ztR1/ci dxmA== X-Forwarded-Encrypted: i=1; AJvYcCXuzTifnJekVuHRyh/magxdejy0cxjgKGuLPkXyAnTyDWxCtil7E4WKzy8zsIOzjk5UslHqXzHl9VjKnguF@lists.postgresql.org X-Gm-Message-State: AOJu0YxeNoMw9VN96NSiqe3PP8ocRYJryjPqiKbkI5Hoo4maOw6psttu yHCywI0BGuGp1cw/uAPWDZmLkxS9v0gmpu9HGHU06CtpPAC+zbsDmgqrq67OBkuZd9IozFtRuNk 1jbiLkjOvMqCNKHflhQx/zqcG1/r6p/NzuvECH0Ti X-Gm-Gg: ASbGnctDHJNFCvt57o3YFHKu08GnvolCKzpuu0645SwczF3pgD6EikPPYIQFibOHX8b JPqHufFmObYGFoDDO0C6q/VQj2ErfgqhToWcOUaH71+Ym2aeRle3ZGigEZXr5RwlFmZJDIiJNv0 /OrUbxIzVY3wzEZywJg8z1TQEMcXwhRV7GBthRZslWfzzDVf9dBezCmSDt7hAmx5MxUIYduicHK LZilQSf X-Google-Smtp-Source: AGHT+IGI7kdCzkncGbp28Noea22QY3m4o1HL/lqFsVkTVFR4mtebcBjQBeFgMpB6BTSSSjEBYna7trfDtyyTNECcdyY= X-Received: by 2002:a05:622a:4012:b0:4ab:41a7:18da with SMTP id d75a77b69052e-4aba224bc4fmr36045101cf.26.1752728800342; Wed, 16 Jul 2025 22:06:40 -0700 (PDT) MIME-Version: 1.0 References: <70BA294B-5A33-4F47-A637-8011C1F279CB@gmail.com> In-Reply-To: From: Lukas Fittl Date: Wed, 16 Jul 2025 22:06:04 -0700 X-Gm-Features: Ac12FXxNnmnCOvnaFZwkEa-er_w6KOusa_1MsQkb6q_JOROJgYid78DsebU_cr4 Message-ID: Subject: Re: query_id: jumble names of temp tables for better pg_stat_statement UX To: Alexander Kukushkin Cc: Michael Paquier , Sami Imseih , Tom Lane , Christoph Berg , PostgreSQL Hackers , ma lz Content-Type: multipart/alternative; boundary="000000000000884590063a18f909" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000884590063a18f909 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jul 15, 2025 at 11:20=E2=80=AFPM Alexander Kukushkin wrote: > However, we regularly hear from many different customers that they *don't > control queries* sent by application or *can't modify these queries*. > Such kinds of workloads are also not that uncommon and this change makes > it impossible to monitor them. > For the workloads you are thinking of, are these "one customer per schema" multi-tenant workloads, or something else? I mentioned this earlier in the discussion (when supporting the change that was done), but the main challenge I've seen is that for "one customer per schema" workloads, pg_stat_statements just doesn't work today, unless you have only a handful of customers on a server. Once you have anything close to 100 or more customer schemas on a server, the churn on the entries makes pg_stat_statements unusable (even with a high max), especially with the current way the query text file works, since you can't reliably read from pg_stat_statements anymore without incurring a read from a 100MB+ query text file. So I agree this change reduces the visibility into which of the schemas had a slow query, but it at least allows reliably using pg_stat_statements to narrow down which query / part of an application is problematic. To get specifics on the schema, one could then use other means (e.g. log_min_duration_statement, auto_explain, etc) to get exact details, grepping the logfile for the query ID retrieved from pg_stat_statements. Thanks, Lukas --=20 Lukas Fittl --000000000000884590063a18f909 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Jul 15, 2025 at = 11:20=E2=80=AFPM Alexander Kukushkin <cyberdemn@gmail.com> wrote:
However, we regularly hear from ma= ny different=C2=A0customers that they *don't control queries* sent by a= pplication or *can't modify these queries*.
Such kinds of workloads are also not that uncom= mon and this change makes it impossible to monitor them.
=

For the workloads you are thinking of, are= these "one customer per schema" multi-tenant workloads, or somet= hing else?

I mentioned this earlier in the discuss= ion (when supporting the change that was done), but the main challenge I= 9;ve seen is that for "one customer per schema" workloads, pg_sta= t_statements just doesn't work today, unless you have only a handful of= customers on a server.

Once you have anything clo= se to 100 or more customer schemas on a server, the churn on the entries ma= kes pg_stat_statements unusable (even with a high max), especially with the= current way the query text file works, since you can't reliably read f= rom pg_stat_statements anymore without incurring a read from a 100MB+ query= text file.

So I agree this change reduces the vis= ibility into which of the schemas had a slow query, but it at least allows = reliably using pg_stat_statements to narrow down which query / part of an a= pplication is problematic. To get specifics on the schema, one could then u= se other means (e.g. log_min_duration_statement, auto_explain, etc) to get = exact details, grepping the logfile for the query ID retrieved from pg_stat= _statements.

Thanks,
Lukas
=C2= =A0
--
=
Lukas Fittl
--000000000000884590063a18f909--