From: Julien Rouhaud <rjuju123@gmail.com>
To: Dirschel, Steve <steve.dirschel@thomsonreuters.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: pg_stat_statements
Date: Wed, 12 Jan 2022 11:03:15 +0800
Message-ID: <20220112030315.vx3lkrvhjanxel7u@jrouhaud> (raw)
In-Reply-To: <DM6PR03MB43324F8A19B1EAE0BCAD7397FA519@DM6PR03MB4332.namprd03.prod.outlook.com>
References: <DM6PR03MB43324F8A19B1EAE0BCAD7397FA519@DM6PR03MB4332.namprd03.prod.outlook.com>
Hi,
On Tue, Jan 11, 2022 at 03:04:14PM +0000, Dirschel, Steve wrote:
>
> I'm not sure if this is the correct distribution list for this type of
> question but I'll try anyways. We have an app that uses multiple schemas.
> It will do a set schema 'schema_name' and execute queries. The queries
> executed are the same regardless of the schema the connection set.
>
> In pg_stat_statements the exact same query will get a different queryid for
> each schema that executes the query.
>
> I'm unable to determine which queryid comes from which schema the query was
> executed under. Is anyone aware of a way to determine this?
>
Unfortunately this is a known limitation.
There were some previous discussions (e.g. [1] and [2] more recently), but I
don't think there was a real consensus on how to solve that problem.
Storing a query text with fully qualified names (either the current query or a
new field) is not practical for performance purpose, but there were no
objections to storing additional information, like the active search_path when
the entry was created. But as noted, while it technically gives the
information you need it's far from being convenient to use, which is probably
why it was never implemented.
[1] https://www.postgresql.org/message-id/flat/8f54c609-17c6-945b-fe13-8b07c0866420%40dalibo.com
[2] https://www.postgresql.org/message-id/flat/9baf5c06-d6ab-c688-010c-843348e3d98c%40gmail.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: rjuju123@gmail.com, steve.dirschel@thomsonreuters.com
Subject: Re: pg_stat_statements
In-Reply-To: <20220112030315.vx3lkrvhjanxel7u@jrouhaud>
References: <DM6PR03MB43324F8A19B1EAE0BCAD7397FA519@DM6PR03MB4332.namprd03.prod.outlook.com> <20220112030315.vx3lkrvhjanxel7u@jrouhaud>
* 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