CREATE EXTENSION pg_stat_monitor;
SELECT pg_stat_monitor_reset();
 pg_stat_monitor_reset 
-----------------------
 
(1 row)

CREATE TABLE t1 (a INTEGER);
CREATE TABLE t2 (b INTEGER);
INSERT INTO t1 VALUES(1);
SELECT a FROM t1;
 a 
---
 1
(1 row)

UPDATE t1 SET a = 2;
DELETE FROM t1;
SELECT b FROM t2 FOR UPDATE;
 b 
---
(0 rows)

TRUNCATE t1;
DROP TABLE t1;
SELECT query, cmd_type,  cmd_type_text FROM pg_stat_monitor ORDER BY query COLLATE "C";
             query              | cmd_type | cmd_type_text 
--------------------------------+----------+---------------
 DELETE FROM t1                 |        4 | DELETE
 INSERT INTO t1 VALUES(1)       |        3 | INSERT
 SELECT a FROM t1               |        1 | SELECT
 SELECT b FROM t2 FOR UPDATE    |        1 | SELECT
 SELECT pg_stat_monitor_reset() |        1 | SELECT
 UPDATE t1 SET a = 2            |        2 | UPDATE
(6 rows)

SELECT pg_stat_monitor_reset();
 pg_stat_monitor_reset 
-----------------------
 
(1 row)

DROP EXTENSION pg_stat_monitor;
