Re: query_id: jumble names of temp tables for better pg_stat_statement UX

From: Lukas Fittl <lukas(at)fittl(dot)com>
To: Alexander Kukushkin <cyberdemn(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Sami Imseih <samimseih(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Christoph Berg <myon(at)debian(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, ma lz <ma100(at)hotmail(dot)com>
Subject: Re: query_id: jumble names of temp tables for better pg_stat_statement UX
Date: 2025-07-17 05:06:04
Message-ID: CAP53PkyHVm6boP5=PahN1Xq7+D+aUZy+zg4QhXXpTCecsJnm6w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Tue, Jul 15, 2025 at 11:20 PM Alexander Kukushkin <cyberdemn(at)gmail(dot)com>
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

--
Lukas Fittl

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2025-07-17 05:14:33 Re: Bypassing Directory Ownership Check in PostgreSQL 16.6 with Secure z/OS NFS (AT-TLS)
Previous Message Amol Inamdar 2025-07-17 04:52:37 Re: Bypassing Directory Ownership Check in PostgreSQL 16.6 with Secure z/OS NFS (AT-TLS)

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2025-07-17 05:09:14 Re: Prevent internal error at concurrent CREATE OR REPLACE FUNCTION
Previous Message Dilip Kumar 2025-07-17 04:26:17 Re: Conflict detection for update_deleted in logical replication