Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>, Atsushi Torikoshi <atorik(at)gmail(dot)com>, Tatsuro Yamada <tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Evgeny Efimkin <efimkin(at)yandex-team(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?
Date: 2020-10-17 03:31:21
Message-ID: CAOBaU_as9GYsjemOvKyyFe=9sjobjUHJdjKs9MtE+QKgxKdNzQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 16, 2020 at 11:04 PM Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>
> On Thu, Oct 15, 2020 at 11:41:23AM +0800, Julien Rouhaud wrote:
> > On Wed, Oct 14, 2020 at 10:40 PM Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > > There is that, and log_line_prefix, which I can imaging being useful.
> > > My point is that if the queryid is visible, there should be a reason it
> > > defaults to show empty.
> >
> > I did some naive benchmarking. Using a custom pgbench script with this query:
> >
> > SELECT *
> > FROM pg_class c
> > JOIN pg_attribute a ON a.attrelid = c.oid
> > ORDER BY 1 DESC
> > LIMIT 1;
> >
> > I can see around 2% overhead (this query is reported with ~ 3ms
> > latency average). Adding a few joins, overhead goes down to 1%.
>
> That number is too high to enable this by default. I suggest we either
> improve the performance of this, or clearly document that you have to
> enable the hash computation to see the pg_stat_activity and
> log_line_prefix fields.

I realize that I didn't update the documentation part to reflect the
new GUC. I'll fix that and add more warnings about the requirements
to have values displayed in pg_stat_acitivity and log_line_prefix.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2020-10-17 04:14:54 Re: [PATCH] Add extra statistics to explain for Nested Loop
Previous Message Julien Rouhaud 2020-10-17 03:28:42 Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?