Re: pg_stat_statements doesn't track commit from pl/pgsql blocks

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: legrand legrand <legrand_legrand(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_stat_statements doesn't track commit from pl/pgsql blocks
Date: 2019-02-22 02:00:52
Message-ID: 20190222020052.4wjwtt3qdyp4rh6f@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)momjian(dot)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 +

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2019-02-22 02:07:28 Re: PG Upgrade with hardlinks, when to start/stop master and replicas
Previous Message Melvin Davidson 2019-02-21 23:09:20 Re: Copy entire schema A to a different schema B