Re: pg_stat_statements

From: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: "Dirschel, Steve" <steve(dot)dirschel(at)thomsonreuters(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_stat_statements
Date: 2022-01-12 10:22:38
Message-ID: CANbhV-GQTFnCZHbReR6S6wVxnqg3VEC6r5kDMtXhfU4wE5vWyg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 12 Jan 2022 at 03:03, Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:
>
> 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.

I see this as a beneficial feature.

If the same SQL is executed against different sets of tables, each
with different indexes, probably different data, the performance could
vary dramatically and might need different tuning on each. So having
separate rows in the pg_stat_statements output makes sense.

> 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.

To differentiate, run each schema using a different user, so you can
tell them apart.

--
Simon Riggs http://www.EnterpriseDB.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Julien Rouhaud 2022-01-12 10:31:41 Re: pg_stat_statements
Previous Message Julien Rouhaud 2022-01-12 03:03:15 Re: pg_stat_statements