mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-06 20:59:21 +02:00
22 lines
789 B
Plaintext
22 lines
789 B
Plaintext
|
CREATE EXTENSION pg_stat_statements;
|
||
|
CREATE TABLE test (a int, b char(20));
|
||
|
-- test the basic functionality of pg_stat_statements
|
||
|
SELECT pg_stat_statements_reset();
|
||
|
pg_stat_statements_reset
|
||
|
--------------------------
|
||
|
|
||
|
(1 row)
|
||
|
|
||
|
INSERT INTO test VALUES(generate_series(1, 10), 'aaa');
|
||
|
UPDATE test SET b = 'bbb' WHERE a > 5;
|
||
|
SELECT query, calls, rows from pg_stat_statements ORDER BY rows;
|
||
|
query | calls | rows
|
||
|
----------------------------------------------------+-------+------
|
||
|
SELECT pg_stat_statements_reset(); | 1 | 1
|
||
|
UPDATE test SET b = ? WHERE a > ?; | 1 | 5
|
||
|
INSERT INTO test VALUES(generate_series(?, ?), ?); | 1 | 10
|
||
|
(3 rows)
|
||
|
|
||
|
DROP TABLE test;
|
||
|
DROP EXTENSION pg_stat_statements;
|