public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: veem v <[email protected]>
To: Ron Johnson <[email protected]>
To: pgsql-general <[email protected]>
Subject: Re: Correct query for monitor
Date: Sat, 27 Sep 2025 08:37:59 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAB+=1TXm-4bAQBiomkoob6RBO3R7QJo_ZzC+KiFv7rQwgtD_EQ@mail.gmail.com>
References: <CAB+=1TWW4DJwD0XPgud2bTJOuW0HkJ+rU11CL=mU93d4HXwfeA@mail.gmail.com>
	<CANzqJaALHY3HiyPz64g1iOaNe9aVmzUe_33KpyqZVsnHMS=P_Q@mail.gmail.com>
	<CAB+=1TXm-4bAQBiomkoob6RBO3R7QJo_ZzC+KiFv7rQwgtD_EQ@mail.gmail.com>

On Sat, 2025-09-27 at 01:45 +0530, veem v wrote:
> If we want to identify, what exact query inside a procedure is taking a longer time:
> - Using any pg_* views, Is there an easy way to tie the query_id of the procedure
> with the query_ids of the internal sqls(those are executed within the procedure)
> to quickly get the culprit sql?

No, you have to read the function body.  Then you can look for the statements therein
in pg_stat_statements.

> And say , we got the sql and saw a bad plan and we want to change the plan or attach
> a good plan to that query , is there a possible way to do that in postgres?

No, there isn't.  You can use the pg_hint_plan extension and its query hints to force
a certain execution plan.

Yours,
Laurenz Albe






view thread (3+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Correct query for monitor
  In-Reply-To: <[email protected]>

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

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