pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Bruce Momjian <bruce@momjian.us>
Cc: Julien Rouhaud <rjuju123@gmail.com>
Cc: Hannu Krosing <hannuk@google.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: torikoshia <torikoshia@oss.nttdata.com>
Cc: Atsushi Torikoshi <atorik@gmail.com>
Cc: Tatsuro Yamada <tatsuro.yamada.tf@nttcom.co.jp>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Evgeny Efimkin <efimkin@yandex-team.ru>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?
Date: Wed, 31 Mar 2021 11:18:45 -0300
Message-ID: <20210331141845.GA958@alvherre.pgsql> (raw)
In-Reply-To: <20210331130643.GA11608@momjian.us>

On 2021-Mar-31, Bruce Momjian wrote:

> On Wed, Mar 31, 2021 at 11:25:32AM +0800, Julien Rouhaud wrote:
> > On Thu, Mar 25, 2021 at 10:36:38AM +0800, Julien Rouhaud wrote:
> > > On Wed, Mar 24, 2021 at 01:02:00PM -0300, Alvaro Herrera wrote:

> > > > I find it odd that there's executor code that acquires the current query
> > > > ID from pgstat, after having been put there by planner or ExecutorStart
> > > > itself.  Seems like a modularity violation.  I wonder if it would make
> > > > more sense to have the value maybe in struct EState (or perhaps there's
> > > > a better place -- but I don't think they have a way to reach the
> > > > QueryDesc anyhow), put there by ExecutorStart, so that places such as
> > > > execParallel, nodeGather etc don't have to fetch it from pgstat but from
> > > > EState.
> > > 
> > > The current queryid is already available in the Estate, as the underlying
> > > PlannedStmt contains it.  The problem is that we want to display the top level
> > > queryid, not the current query one, and the top level queryid is held in
> > > pgstat.
> > 
> > So is the current approach ok?  If not I'm afraid that detecting and caching
> > the top level queryid in the executor parts would lead to some code
> > duplication.
> 
> I assume it is since Alvaro didn't reply.  I am planning to apply this
> soon.

I'm afraid I don't know enough about how parallel query works to make a
good assessment on this being a good approach or not -- and no time at
present to figure it all out.

-- 
Álvaro Herrera                            39°49'30"S 73°17'W
"I think my standards have lowered enough that now I think 'good design'
is when the page doesn't irritate the living f*ck out of me." (JWZ)





view thread (222+ messages)  latest in thread

Message-ID: <20210331141845.GA958@alvherre.pgsql>
Permalink:  ../20210331141845.GA958@alvherre.pgsql/
Also on:    postgresql.org/message-id/20210331141845.GA958@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, bruce@momjian.us, rjuju123@gmail.com, hannuk@google.com, robertmhaas@gmail.com, pavel.stehule@gmail.com, tgl@sss.pgh.pa.us, michael@paquier.xyz, torikoshia@oss.nttdata.com, atorik@gmail.com, tatsuro.yamada.tf@nttcom.co.jp, tomas.vondra@2ndquadrant.com, efimkin@yandex-team.ru, pgsql-hackers@lists.postgresql.org
  Subject: Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?
  In-Reply-To: <20210331141845.GA958@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox