blob: 7a307a59c3d3edabb61f7ede301feeb0edd1e48f [file] [log] [blame]
CREATE FUNCTION f1() RETURNS BOOLEAN
AS
'
BEGIN
RETURN true;
END
' LANGUAGE 'plpgsql';
CREATE FUNCTION
SELECT f1();
f1
----
t
(1 row)
CREATE TABLE t1 ( uid INTEGER PRIMARY KEY, uname TEXT NOT NULL );
CREATE TABLE
INSERT INTO t1 VALUES ( 101, 'Park Gyu-Ri' );
INSERT 0 1
INSERT INTO t1 VALUES ( 102, 'Han Seung-Yeon' );
INSERT 0 1
INSERT INTO t1 VALUES ( 103, 'Nicole' );
INSERT 0 1
INSERT INTO t1 VALUES ( 104, 'Koo Ha-Ra' );
INSERT 0 1
INSERT INTO t1 VALUES ( 105, 'Kang Ji-Young' );
INSERT 0 1
CREATE SEQUENCE s1;
CREATE SEQUENCE
SELECT nextval('s1');
nextval
---------
1
(1 row)
ANALYZE t1;
ANALYZE
ANALYZE s1;
ANALYZE
SELECT pg_sleep(1);
pg_sleep
----------
(1 row)
SELECT count(*) FROM pgperf.snapshot;
count
-------
0
(1 row)
SELECT count(*) FROM pgperf.snapshot_pg_statio_user_tables WHERE schemaname <> 'pgperf';
count
-------
0
(1 row)
SELECT count(*) FROM pgperf.snapshot_pg_statio_user_sequences WHERE schemaname <> 'pgperf';
count
-------
0
(1 row)
SELECT count(*) FROM pgperf.snapshot_pg_stat_user_functions WHERE schemaname <> 'pgperf';
count
-------
0
(1 row)
SELECT pgperf.create_snapshot(1);
create_snapshot
-----------------
0
(1 row)
SELECT count(*) FROM pgperf.snapshot;
count
-------
1
(1 row)
SELECT count(*) FROM pgperf.snapshot_pg_statio_user_tables WHERE schemaname <> 'pgperf';
count
-------
1
(1 row)
SELECT count(*) FROM pgperf.snapshot_pg_statio_user_sequences WHERE schemaname <> 'pgperf';
count
-------
1
(1 row)
SELECT count(*) FROM pgperf.snapshot_pg_stat_user_functions WHERE schemaname <> 'pgperf';
count
-------
4
(1 row)
SELECT count(*) FROM pgperf.snapshot_pg_stats WHERE schemaname = 'public';
count
-------
0
(1 row)
SELECT pgperf.create_snapshot(2);
create_snapshot
-----------------
1
(1 row)
SELECT count(*) FROM pgperf.snapshot_pg_stats WHERE schemaname = 'public';
count
-------
2
(1 row)
SELECT count(*) FROM pgperf.snapshot_pgstattuple WHERE schemaname <> 'pgperf';
count
-------
0
(1 row)
SELECT count(*) FROM pgperf.snapshot_pgstatindex WHERE schemaname <> 'pgperf';
count
-------
0
(1 row)
SELECT pgperf.create_snapshot(4);
create_snapshot
-----------------
2
(1 row)
SELECT count(*) FROM pgperf.snapshot_pgstattuple WHERE schemaname <> 'pgperf';
count
-------
1
(1 row)
SELECT count(*) FROM pgperf.snapshot_pgstatindex WHERE schemaname <> 'pgperf';
count
-------
1
(1 row)
SELECT count(*) FROM pgperf.snapshot;
count
-------
3
(1 row)
SELECT sid,level FROM pgperf.snapshot order by ts;
sid | level
-----+-------
0 | 1
1 | 2
2 | 4
(3 rows)
SELECT pgperf.delete_snapshot(2);
delete_snapshot
-----------------
t
(1 row)
SELECT count(*) FROM pgperf.snapshot_pgstattuple WHERE schemaname <> 'pgperf';
count
-------
0
(1 row)
SELECT count(*) FROM pgperf.snapshot_pgstatindex WHERE schemaname <> 'pgperf';
count
-------
0
(1 row)
SELECT pgperf.delete_snapshot(1);
delete_snapshot
-----------------
t
(1 row)
SELECT count(*) FROM pgperf.snapshot_pg_stats WHERE schemaname = 'public';
count
-------
0
(1 row)
SELECT pgperf.delete_snapshot(0);
delete_snapshot
-----------------
t
(1 row)
SELECT count(*) FROM pgperf.snapshot;
count
-------
0
(1 row)
SELECT count(*) FROM pgperf.snapshot_pg_statio_user_tables WHERE schemaname <> 'pgperf';
count
-------
0
(1 row)
DROP TABLE t1;
DROP TABLE
DROP SEQUENCE s1;
DROP SEQUENCE
DROP FUNCTION f1();
DROP FUNCTION