0% found this document useful (0 votes)
90 views4 pages

PG Profile Extension

The document demonstrates the installation and usage of the pg_profile PostgreSQL extension. It shows commands to extract, install and enable the extension. Samples are taken on multiple servers and queries run to view the samples, baselines and reports generated. Issues connecting to one server are also demonstrated along with resolving the connection.

Uploaded by

Rajkishore Patro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views4 pages

PG Profile Extension

The document demonstrates the installation and usage of the pg_profile PostgreSQL extension. It shows commands to extract, install and enable the extension. Samples are taken on multiple servers and queries run to view the samples, baselines and reports generated. Issues connecting to one server are also demonstrated along with resolving the connection.

Uploaded by

Rajkishore Patro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

pg_profile:

[root@SCDvLBTC28 ~]# cd /usr/edb/as12/share/extension/


[root@SCDvLBTC28 extension]# ls -ltr *gz
-rw-r--r-- 1 root root 186808 Jun 1 14:06 pg_profile--0.3.6.tar.gz
[root@SCDvLBTC28 extension]# tar xzf pg_profile--0.3.6.tar.gz --directory
/usr/edb/as12/share/extension/
[root@SCDvLBTC28 extension]# ls -ltr
total 3928
-rw-r--r-- 1 root root 2259 Nov 24 2019 pldbgapi--unpackaged--1.1.sql

postgres=# CREATE EXTENSION pg_profile;


CREATE EXTENSION
postgres=# \dx
List of installed extensions
Name | Version | Schema | Description
--------------------+---------+------------
+----------------------------------------------------------------
dblink | 1.2 | public | connect to other PostgreSQL databases
from within a database
pg_profile | 0.3.6 | public | PostgreSQL load profile repository and
report builder
pg_stat_statements | 1.7 | public | track execution statistics of all SQL
statements executed
(14 rows)

postgres=# select * from show_servers();


server_name | connstr | enabled | description
-------------+---------------------------+---------+-------------
local | dbname=postgres port=5444 | t |
(1 row)

postgres=# select * from show_samples;


sample | sample_time | sizes_collected | dbstats_reset | clustats_reset |
archstats_reset
--------+-------------+-----------------+---------------+----------------
+-----------------
(0 rows)

postgres=# select * from take_sample();


server | result | elapsed
--------+--------+-------------
local | OK | 00:00:00.48
(1 row)

postgres=# select * from show_samples;


sample | sample_time | sizes_collected | dbstats_reset |
clustats_reset | archstats_reset
--------+---------------------------+-----------------+---------------
+----------------+-----------------
1 | 01-JUN-22 14:13:23 +03:00 | t | |
|
(1 row)

postgres=# select count(*) from pg_stat_statements;


count
-------
31
(1 row)

postgres=# select * from take_sample();


server | result | elapsed
--------+--------+-------------
local | OK | 00:00:00.44
(1 row)

postgres=# select * from show_samples;


sample | sample_time | sizes_collected | dbstats_reset |
clustats_reset | archstats_reset
--------+---------------------------+-----------------+---------------
+----------------+-----------------
1 | 01-JUN-22 14:13:23 +03:00 | t | |
|
2 | 01-JUN-22 14:13:56 +03:00 | t | |
|
(2 rows)

-bash-4.2$ psql -d postgres -Aqtc "SELECT get_report('local',1,2)" -o


1st_report.html

postgres=# select create_baseline('local2',1,4,30);


create_baseline
-----------------
4
(1 row)

postgres=# select * from show_baselines();


baseline | min_sample | max_sample | keep_until_time
----------+------------+------------+---------------------------
local2 | 1 | 4 | 01-JUL-22 22:44:44 +03:00
local | 1 | 3 | 05-JUN-22 15:15:39 +03:00
(2 rows)

postgres=# SELECT create_server('plmtest','host=10.21.180.131 dbname=postgres


port=5444');
create_server
---------------
2
(1 row)

postgres=# select * from take_sample();


server | result
| elapsed
---------
+-----------------------------------------------------------------------------
+-------------
local | OK
| 00:00:00.47
plmtest | could not establish connection
+| 00:00:00.03
| SQL statement "SELECT
dblink_connect('server_connection',server_connstr)" +|
| PL/pgSQL function take_sample(integer,boolean) line 138 at PERFORM
+|
| PL/pgSQL function take_sample_subset(integer,integer) line 27 at
assignment+|
| SQL function "take_sample" statement 1
+|
| fe_sendauth: no password supplied
|
(2 rows)

postgres=# select * from take_sample();


server | result | elapsed
---------+--------+-------------
plmtest | OK | 00:00:00.63
local | OK | 00:00:00.51
(2 rows)

postgres=# select * from show_samples('plmtest');


sample | sample_time | sizes_collected | dbstats_reset |
bgwrstats_reset | archstats_reset
--------+---------------------------+-----------------+---------------
+-----------------+-----------------
1 | 03-JUN-22 21:55:05 +03:00 | t | |
|
(1 row)

postgres=# select * from show_samples;


sample | sample_time | sizes_collected | dbstats_reset |
clustats_reset | archstats_reset
--------+---------------------------+-----------------+---------------
+----------------+-----------------
1 | 01-JUN-22 14:13:23 +03:00 | t | |
|
2 | 01-JUN-22 14:13:56 +03:00 | t | |
|
3 | 01-JUN-22 14:55:35 +03:00 | t | |
|
4 | 01-JUN-22 22:41:08 +03:00 | t | |
|
5 | 01-JUN-22 22:42:18 +03:00 | t | |
|
6 | 03-JUN-22 19:02:35 +03:00 | t | |
|
7 | 03-JUN-22 21:55:05 +03:00 | t | |
|
(7 rows)

You might also like