pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_stat_statements doesn't track commit from pl/pgsql blocks
3+ messages / 2 participants
[nested] [flat]

* pg_stat_statements doesn't track commit from pl/pgsql blocks
@ 2019-02-17 21:52  legrand legrand <legrand_legrand@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: legrand legrand @ 2019-02-17 21:52 UTC (permalink / raw)
  To: pgsql-general

Hello,

It seems that pgss doesn't track commit (nor rollback) commands from
pl/pgsql blocks.
using psql in version 11.1:

select pg_stat_statements_reset();
do $$ begin commit; end $$;
select calls,query from pg_stat_statements;

...

I don't know how difficult it would be to fix it,
but this could help in trouble shouting.

Regards
PAscal



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pg_stat_statements doesn't track commit from pl/pgsql blocks
@ 2019-02-22 02:00  Bruce Momjian <bruce@momjian.us>
  parent: legrand legrand <legrand_legrand@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Bruce Momjian @ 2019-02-22 02:00 UTC (permalink / raw)
  To: legrand legrand <legrand_legrand@hotmail.com>; +Cc: pgsql-general

On Sun, Feb 17, 2019 at 02:52:07PM -0700, legrand legrand wrote:
> Hello,
> 
> It seems that pgss doesn't track commit (nor rollback) commands from
> pl/pgsql blocks.
> using psql in version 11.1:
> 
> select pg_stat_statements_reset();
> do $$ begin commit; end $$;
> select calls,query from pg_stat_statements;

Uh, can you show me exactly what you were hoping to see?  I see:

	CREATE EXTENSION pg_stat_statements;
	
	SELECT pg_stat_statements_reset();
	 pg_stat_statements_reset
	--------------------------
	
	DO $$ BEGIN COMMIT; END $$;
	
	SELECT calls,query FROM pg_stat_statements;
	 calls |               query
	-------+-----------------------------------
	     1 | select pg_stat_statements_reset()
	     1 | do $$ begin commit; end $$

You wanted to see the 'commit'?  That is not a client-supplied command
and is not tracked, and I am not sure we would want to do that.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* RE: pg_stat_statements doesn't track commit from pl/pgsql blocks
@ 2019-02-22 20:47  legrand legrand <legrand_legrand@hotmail.com>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 0 replies; 3+ messages in thread

From: legrand legrand @ 2019-02-22 20:47 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; pgsql-general


forgot to cc pgsql-general list

________________________________
De : legrand legrand <legrand_legrand@hotmail.com>
Envoyé : vendredi 22 février 2019 20:26
À : Bruce Momjian
Objet : RE: pg_stat_statements doesn't track commit from pl/pgsql blocks

Hello Bruce,

thank you for taking time to answer.
yes, I was expecting something like

        SELECT calls,query FROM pg_stat_statements;
         calls |               query
        -------+-----------------------------------
             1 | select pg_stat_statements_reset()
             1 | do $$ begin commit; end $$
             1 | commit

as I didn't found any other place to track this 'commit' information.

nb: I don't "want" anything this is just an open question,
and I'm perfectly able to ear that its not expected or not easy to implement.

Regards
PAscal

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-02-22 20:47 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-02-17 21:52 pg_stat_statements doesn't track commit from pl/pgsql blocks legrand legrand <legrand_legrand@hotmail.com>
2019-02-22 02:00 ` Bruce Momjian <bruce@momjian.us>
2019-02-22 20:47   ` legrand legrand <legrand_legrand@hotmail.com>

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