Re: How Do You Associate a Query With its Invoking Procedure?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 13, 2018 at 12:49 PM, Fd Habash <fmhabash@xxxxxxxxx> wrote:

In API function may invoke 10 queries. Ideally, I would like to know what queries are invoked by it and how long each took.

 

I’m using pg_stat_statement. I can see the API function statement, but how do I deterministically identify all queries invoked by it?


pg_stat_statement is a global tracker that throws away execution context, in this case the process id, needed to track the level of detail you desire.  I think the best you can do is log all statements and durations to the log file and parse that.

For the "what queries are invoked by it" you can just read the source code...

As there is no canned solution to provide the answer you seek the final solution you come up with will be influenced by your access patterns, specific needs, and (in)ability to write C code (though maybe there is an extension out there you could leverage...).

David J.


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux