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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Julien Rouhaud <julien(dot)rouhaud(at)free(dot)fr>
Cc: Andres Freund <andres(at)anarazel(dot)de>, 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: 2019-08-01 18:20:46
Message-ID: CA+TgmoYyFN3FuiC+E0Ug4ceXmfUYKpmqx6xZdLZq-F9ZJoZutg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 1, 2019 at 2:46 AM Julien Rouhaud <julien(dot)rouhaud(at)free(dot)fr> wrote:
> This patch is actually storing the queryid in PGPROC, not in
> PgBackendStatus, thus the need for an atomic. I used PGPROC because
> the value needs to be available in log_line_prefix() and spi.c, so
> pgstat.c / PgBackendStatus didn't seem like the best interface in that
> case. Is widening PGPROC is too expensive for this purpose?

I doubt it.

However, I think that the fact that this patch adds 15 new calls to
pg_atomic_write_u64(&MyProc->queryId, ...) is probably not a good
sign. It seems like we ought to be able to centralize it better than
that.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-08-01 18:25:23 Re: UCT (Re: pgsql: Update time zone data files to tzdata release 2019a.)
Previous Message Tom Lane 2019-08-01 17:59:11 Re: UCT (Re: pgsql: Update time zone data files to tzdata release 2019a.)