Merge pull request #200 from nastena1606/PG-364-Align-doc-structure-with-main
PG-364 Aligned docs structure with mainpull/201/head
commit
1ed35c648a
|
@ -2,7 +2,7 @@ name: Build pg_stat_monitor docs
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- REL1_0_STABLE
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -44,7 +44,6 @@ jobs:
|
||||||
# Deploy docs
|
# Deploy docs
|
||||||
- name: Deploy docs
|
- name: Deploy docs
|
||||||
run: |
|
run: |
|
||||||
mike deploy main -p
|
mike deploy REL1_0_STABLE -p
|
||||||
mike set-default main -p
|
mike retitle REL1_0_STABLE "1.0.x (stable)" -p
|
||||||
mike retitle main "latest" -p
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,12 @@
|
||||||
|
<svg width="74" height="74" viewBox="0 0 74 74" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="37" cy="37" r="37" fill="url(#paint0_linear)"/>
|
||||||
|
<path d="M37.5003 58C49.3744 58 59 48.3743 59 36.5C59 24.6257 49.3744 15 37.5003 15C25.6261 15 16 24.6257 16 36.5C16 36.6671 16.0019 36.8338 16.0057 37H16V67.4672C18.744 69.3622 21.7566 70.896 24.969 72H25V53.9948C28.5225 56.5161 32.8381 58 37.5003 58Z" fill="white"/>
|
||||||
|
<path d="M50 36.5C50 43.4036 44.4037 49 37.5001 49C30.5966 49 25 43.4036 25 36.5C25 29.5964 30.5966 24 37.5001 24C44.4037 24 50 29.5964 50 36.5Z" fill="#FCB42F"/>
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="paint0_linear" x1="37" y1="0" x2="37" y2="74" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop stop-color="#FBB32F"/>
|
||||||
|
<stop offset="0.504739" stop-color="#C11511"/>
|
||||||
|
<stop offset="1" stop-color="#C11411"/>
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 878 B |
|
@ -0,0 +1,16 @@
|
||||||
|
[data-md-color-scheme="percona-light"] {
|
||||||
|
--md-primary-fg-color: #e97e03;
|
||||||
|
--md-primary-fg-color--light: #ECB7B7;
|
||||||
|
--md-primary-fg-color--dark: #90030C;
|
||||||
|
}
|
||||||
|
[data-md-color-scheme="slate"] {
|
||||||
|
--md-primary-fg-color: #e97e03;
|
||||||
|
/*
|
||||||
|
--md-primary-fg-color--light: #ECB7B7;
|
||||||
|
--md-primary-fg-color--dark: #90030C;
|
||||||
|
*/
|
||||||
|
--md-hue: 210; /* [0, 360] */
|
||||||
|
}
|
||||||
|
ul li p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
.sphinxsidebarwrapper {
|
||||||
|
padding-right: 0 !important;
|
||||||
|
}
|
||||||
|
/* Turns off bullets within toctree */
|
||||||
|
.sphinxsidebarwrapper ul {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
.sphinxsidebarwrapper>ul {
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
.sphinxsidebarwrapper>ul>li {
|
||||||
|
padding: 0 0 10px 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.custom-button {
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 10px;
|
||||||
|
margin-right: 5px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 400;
|
||||||
|
border: none;
|
||||||
|
background-color: transparent;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-button~ul {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-button--main-active {
|
||||||
|
background-color: #e3e3e3
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-button.custom-button--active~ul {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-button:before {
|
||||||
|
content: '+';
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-button.custom-button--active:before {
|
||||||
|
content: '-';
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
# Welcome
|
||||||
|
|
||||||
|
The **pg_stat_monitor** is a **_Query Performance Monitoring_** tool for PostgreSQL. It collects performance stats and provides query performance insights in a single view. These insights allow database users to understand query origins, execution, planning statistics and details, query information, and metadata. This significantly improves observability, enabling users to debug and tune query performance.
|
||||||
|
|
||||||
|
|
||||||
|
## How `pg_stat_monitor` works?
|
||||||
|
|
||||||
|
`pg_stat_monitor` is developed on the basis of `pg_stat_statements` as its more advanced replacement. While `pg_stat_statements` provides ever-increasing metrics, `pg_stat_monitor` aggregates the collected data, saving user efforts for doing it themselves. `pg_stat_monitor` stores statistics in configurable time-based units – _buckets_. Such bucket-based data collection allows focusing on statistics generated for shorter time periods and makes query timing information such as max/min/mean time more accurate.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* **Time Interval Grouping:** Instead of supplying one set of ever-increasing counts, `pg_stat_monitor` computes stats for a configured number of time intervals - time buckets. This allows for much better data accuracy, especially in the case of high resolution or unreliable networks.
|
||||||
|
* **Multi-Dimensional Grouping:** While `pg_stat_statements` groups counters by userid, dbid, queryid, `pg_stat_monitor` uses a more detailed group for higher precision. This allows a user to drill down into the performance of queries.
|
||||||
|
* **Capture Actual Parameters in the Queries:** `pg_stat_monitor` allows you to choose if you want to see queries with placeholders for parameters or actual parameter data. This simplifies debugging and analysis processes by enabling users to execute the same query.
|
||||||
|
* **Query Plan:** Each SQL is now accompanied by its actual plan that was constructed for its execution. That's a huge advantage if you want to understand why a particular query is slower than expected.
|
||||||
|
* **Tables Access Statistics for a Statement:** This allows us to easily identify all queries that accessed a given table. This set is at par with the information provided by the `pg_stat_statements`.
|
||||||
|
* **Histogram:** Visual representation is very helpful as it can help identify issues. With the help of the histogram function, one can now view a timing/calling data histogram in response to an SQL query. And yes, it even works in psql.
|
||||||
|
|
||||||
|
|
||||||
|
## Availability
|
||||||
|
|
||||||
|
`pg_stat_monitor` supports PostgreSQL versions 11 and above. It is compatible with both PostgreSQL provided by PostgreSQL Global Development Group (PGDG) and [Percona Distribution for PostgreSQL](https://www.percona.com/software/postgresql-distribution).
|
||||||
|
|
||||||
|
|
||||||
|
### Supported versions
|
||||||
|
|
||||||
|
The `pg_stat_monitor` should work on the latest version of both [Percona Distribution for PostgreSQL](https://www.percona.com/software/postgresql-distribution) and PostgreSQL, but is only tested with these versions:
|
||||||
|
|
||||||
|
| **Distribution** | **Version** | **Provider** |
|
||||||
|
| ---------------- | --------------- | ------------ |
|
||||||
|
|[Percona Distribution for PostgreSQL](https://www.percona.com/software/postgresql-distribution)| [11](https://www.percona.com/downloads/percona-postgresql-11/LATEST/), [12](https://www.percona.com/downloads/postgresql-distribution-12/LATEST/), [13](https://www.percona.com/downloads/postgresql-distribution-13/LATEST/) and [14](https://www.percona.com/downloads/postgresql-distribution-14/LATEST/)| Percona|
|
||||||
|
| PostgreSQL | 11, 12, 13 and 14 | PostgreSQL Global Development Group (PGDG) |
|
||||||
|
|
||||||
|
The RPM (for RHEL and CentOS) and the DEB (for Debian and Ubuntu) packages are available from Percona repositories for PostgreSQL versions [11](https://www.percona.com/downloads/percona-postgresql-11/LATEST/), [12](https://www.percona.com/downloads/postgresql-distribution-12/LATEST/), [13](https://www.percona.com/downloads/postgresql-distribution-13/LATEST/) and [14](https://www.percona.com/downloads/postgresql-distribution-14/LATEST/).
|
||||||
|
|
||||||
|
The RPM packages are also available in the official PostgreSQL (PGDG) `yum` repositories.
|
||||||
|
|
||||||
|
## Get started
|
||||||
|
|
||||||
|
* Use the [installation guidelines](setup.md) to install and set up `pg_stat_monitor`.
|
||||||
|
* Refer to the [User guide](USER_GUIDE.md) for details about available features and functions, usage examples and configuration parameters.
|
||||||
|
|
||||||
|
## Read more
|
||||||
|
|
||||||
|
* [`pg_stat_monitor` view reference](REREFENCE.md)
|
||||||
|
* [pg_stat_monitor and pg_stat_statements comparison](COMPARE.md)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,120 @@
|
||||||
|
setTimeout(() => {
|
||||||
|
const asideMenu = document.getElementsByClassName('sphinxsidebarwrapper')[0];
|
||||||
|
hideSubMenus();
|
||||||
|
asideMenu.style.display = 'block';
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
function hideSubMenus() {
|
||||||
|
const asideMenu = document.getElementsByClassName('sphinxsidebarwrapper')[0];
|
||||||
|
const activeCheckboxClass = 'custom-button--active';
|
||||||
|
const activeBackgroundClass = 'custom-button--main-active';
|
||||||
|
const links = Array.from(asideMenu.getElementsByTagName('a'));
|
||||||
|
const accordionLinks = links.filter(links => links.nextElementSibling && links.nextElementSibling.localName === 'ul');
|
||||||
|
const simpleLinks = links.filter(links => !links.nextElementSibling && links.parentElement.localName === 'li');
|
||||||
|
|
||||||
|
simpleLinks.forEach(simpleLink => {
|
||||||
|
simpleLink.parentElement.style.listStyleType = 'disc';
|
||||||
|
simpleLink.parentElement.style.marginLeft = '20px';
|
||||||
|
});
|
||||||
|
|
||||||
|
accordionLinks.forEach((link, index) => {
|
||||||
|
insertButton(link, index);
|
||||||
|
});
|
||||||
|
|
||||||
|
const buttons = Array.from(document.getElementsByClassName('custom-button'));
|
||||||
|
|
||||||
|
buttons.forEach(button => button.addEventListener('click', event => {
|
||||||
|
event.preventDefault();
|
||||||
|
const current = event.currentTarget;
|
||||||
|
const parent = current.parentElement;
|
||||||
|
const isMain = Array.from(parent.classList).includes('toctree-l1');
|
||||||
|
const isMainActive = Array.from(parent.classList).includes(activeBackgroundClass);
|
||||||
|
const targetClassList = Array.from(current.classList);
|
||||||
|
|
||||||
|
toggleElement(targetClassList.includes(activeCheckboxClass), current, activeCheckboxClass);
|
||||||
|
if (isMain) {
|
||||||
|
toggleElement(isMainActive, parent, activeBackgroundClass);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
// WIP var toctree_heading = document.getElementById("toctree-heading");
|
||||||
|
// NOT NEEDED? asideMenu.parentNode.insertBefore(styleDomEl, asideMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleElement(condition, item, className) {
|
||||||
|
const isButton = item.localName === 'button';
|
||||||
|
|
||||||
|
if (!condition) {
|
||||||
|
const previousActive = Array.from(item.parentElement.parentElement.getElementsByClassName('list-item--active'));
|
||||||
|
if (isButton) {
|
||||||
|
localStorage.setItem(item.id, 'true');
|
||||||
|
|
||||||
|
if (previousActive.length) {
|
||||||
|
previousActive.forEach(previous => {
|
||||||
|
|
||||||
|
const previousActiveButtons = Array.from(previous.getElementsByClassName('custom-button--active'));
|
||||||
|
removeClass(previous, ['list-item--active', 'custom-button--main-active']);
|
||||||
|
|
||||||
|
if (previousActiveButtons.length) {
|
||||||
|
previousActiveButtons.forEach(previousButton => {
|
||||||
|
|
||||||
|
removeClass(previousButton, 'custom-button--active');
|
||||||
|
localStorage.removeItem(previousButton.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addClass(item, className);
|
||||||
|
addClass(item.parentElement, 'list-item--active');
|
||||||
|
} else {
|
||||||
|
removeClass(item, className);
|
||||||
|
removeClass(item.parentElement, 'list-item--active');
|
||||||
|
|
||||||
|
if (isButton) {
|
||||||
|
localStorage.removeItem(item.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function addClass(item, classes) {
|
||||||
|
item.classList.add(...Array.isArray(classes) ? classes : [classes]);
|
||||||
|
}
|
||||||
|
function removeClass(item, classes) {
|
||||||
|
item.classList.remove(...Array.isArray(classes) ? classes : [classes]);
|
||||||
|
}
|
||||||
|
function insertButton(element, id) {
|
||||||
|
const button = document.createElement('button');
|
||||||
|
const isMain = Array.from(element.parentElement.classList).includes('toctree-l1');
|
||||||
|
button.id = id;
|
||||||
|
addClass(button, 'custom-button');
|
||||||
|
if (localStorage.getItem(id)) {
|
||||||
|
addClass(button, 'custom-button--active');
|
||||||
|
addClass(element.parentElement, 'list-item--active');
|
||||||
|
if (isMain) {
|
||||||
|
addClass(element.parentElement, 'custom-button--main-active');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
element.insertAdjacentElement('beforebegin', button);
|
||||||
|
}
|
||||||
|
function makeSelect() {
|
||||||
|
const custom_select = document.getElementById('custom_select');
|
||||||
|
const select_active_option = custom_select.getElementsByClassName('select-active-text')[0];
|
||||||
|
const custom_select_list = document.getElementById('custom_select_list');
|
||||||
|
|
||||||
|
select_active_option.innerHTML = window.location.href.includes('') ?
|
||||||
|
custom_select_list.getElementsByClassName('custom-select__option')[1].innerHTML :
|
||||||
|
custom_select_list.getElementsByClassName('custom-select__option')[0].innerHTML;
|
||||||
|
|
||||||
|
document.addEventListener('click', event => {
|
||||||
|
if (event.target.parentElement.id === 'custom_select' || event.target.id === 'custom_select') {
|
||||||
|
custom_select_list.classList.toggle('select-hidden')
|
||||||
|
}
|
||||||
|
if (Array.from(event.target.classList).includes('custom-select__option')) {
|
||||||
|
select_active_option.innerHTML = event.target.innerHTML;
|
||||||
|
}
|
||||||
|
if (event.target.id !== 'custom_select' && event.target.parentElement.id !== 'custom_select') {
|
||||||
|
custom_select_list.classList.add('select-hidden')
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,208 @@
|
||||||
|
# Setting up `pg_stat_monitor`
|
||||||
|
|
||||||
|
## Supported platforms
|
||||||
|
|
||||||
|
The PostgreSQL YUM repository supports `pg_stat_monitor` for all [supported versions](#supported-versions) for the following platforms:
|
||||||
|
|
||||||
|
* Red Hat Enterprise/Rocky/CentOS/Oracle Linux 7 and 8
|
||||||
|
* Fedora 33 and 34
|
||||||
|
|
||||||
|
Find the list of supported platforms for `pg_stat_monitor` within [Percona Distribution for PostgreSQL](https://www.percona.com/software/postgresql-distribution) on the [Percona Release Lifecycle Overview](https://www.percona.com/services/policies/percona-software-support-lifecycle#pgsql) page.
|
||||||
|
|
||||||
|
|
||||||
|
## Installation guidelines
|
||||||
|
|
||||||
|
You can install `pg_stat_monitor` from the following sources:
|
||||||
|
|
||||||
|
* [Percona repositories](#installing-from-percona-repositories),
|
||||||
|
* [PostgreSQL PGDG yum repositories](#installing-from-postgresql-yum-repositories),
|
||||||
|
* [PGXN](#installing-from-pgxn) and
|
||||||
|
* [source code](#building-from-source).
|
||||||
|
|
||||||
|
|
||||||
|
### Installing from Percona repositories
|
||||||
|
|
||||||
|
To install `pg_stat_monitor` from Percona repositories, you need to use the `percona-release` repository management tool.
|
||||||
|
|
||||||
|
1. [Install percona-release](https://www.percona.com/doc/percona-repo-config/installing.html) following the instructions relevant to your operating system
|
||||||
|
2. Enable Percona repository:
|
||||||
|
|
||||||
|
``` sh
|
||||||
|
percona-release setup ppgXX
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace XX with the desired PostgreSQL version. For example, to install `pg_stat_monitor ` for PostgreSQL 13, specify `ppg13`.
|
||||||
|
|
||||||
|
3. Install `pg_stat_monitor` package
|
||||||
|
|
||||||
|
* For Debian and Ubuntu:
|
||||||
|
|
||||||
|
``` sh
|
||||||
|
apt-get install percona-pg-stat-monitor13
|
||||||
|
```
|
||||||
|
|
||||||
|
* For RHEL and CentOS:
|
||||||
|
|
||||||
|
``` sh
|
||||||
|
yum install percona-pg-stat-monitor13
|
||||||
|
```
|
||||||
|
|
||||||
|
### Installing from PostgreSQL `yum` repositories
|
||||||
|
|
||||||
|
Install the PostgreSQL repositories following the instructions in the [Linux downloads (Red Hat family)](https://www.postgresql.org/download/linux/redhat/) chapter in PostgreSQL documentation.
|
||||||
|
|
||||||
|
Install `pg_stat_monitor`:
|
||||||
|
|
||||||
|
```
|
||||||
|
dnf install -y pg_stat_monitor_<VERSION>
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace the `VERSION` variable with the PostgreSQL version you are using (e.g. specify `pg_stat_monitor_13` for PostgreSQL 13)
|
||||||
|
|
||||||
|
|
||||||
|
### Installing from PGXN
|
||||||
|
|
||||||
|
You can install `pg_stat_monitor` from PGXN (PostgreSQL Extensions Network) using the [PGXN client](https://pgxn.github.io/pgxnclient/).
|
||||||
|
|
||||||
|
Use the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
pgxn install pg_stat_monitor
|
||||||
|
```
|
||||||
|
|
||||||
|
### Building from source
|
||||||
|
|
||||||
|
To build `pg_stat_monitor` from source code, you require the following:
|
||||||
|
|
||||||
|
* git
|
||||||
|
* make
|
||||||
|
* gcc
|
||||||
|
* pg_config
|
||||||
|
|
||||||
|
You can download the source code of the latest release of `pg_stat_monitor` from [the releases page on GitHub](https://github.com/Percona/pg_stat_monitor/releases) or using git:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone git://github.com/Percona/pg_stat_monitor.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Compile and install the extension
|
||||||
|
|
||||||
|
```
|
||||||
|
cd pg_stat_monitor
|
||||||
|
make USE_PGXS=1
|
||||||
|
make USE_PGXS=1 install
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
You can enable `pg_stat_monitor` when your `postgresql` instance is not running.
|
||||||
|
|
||||||
|
`pg_stat_monitor` needs to be loaded at the start time. The extension requires additional shared memory; therefore, add the `pg_stat_monitor` value for the `shared_preload_libraries` parameter and restart the `postgresql` instance.
|
||||||
|
|
||||||
|
Use the [ALTER SYSTEM](https://www.postgresql.org/docs/current/sql-altersystem.html)command from `psql` terminal to modify the `shared_preload_libraries` parameter.
|
||||||
|
|
||||||
|
```sql
|
||||||
|
ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_monitor';
|
||||||
|
```
|
||||||
|
|
||||||
|
> **NOTE**: If you’ve added other modules to the `shared_preload_libraries` parameter (for example, `pg_stat_statements`), list all of them separated by commas for the `ALTER SYSTEM` command.
|
||||||
|
>
|
||||||
|
>:warning: For PostgreSQL 13 and earlier versions,`pg_stat_monitor` **must** follow `pg_stat_statements`. For example, `ALTER SYSTEM SET shared_preload_libraries = 'foo, pg_stat_statements, pg_stat_monitor'`.
|
||||||
|
>
|
||||||
|
>In PostgreSQL 14, you can specify `pg_stat_statements` and `pg_stat_monitor` in any order. However, due to the extensions' architecture, if both `pg_stat_statements` and `pg_stat_monitor` are loaded, only the last listed extension captures utility queries, CREATE TABLE, Analyze, etc. The first listed extension captures most common queries like SELECT, UPDATE, INSERT, but does not capture utility queries.
|
||||||
|
>
|
||||||
|
>Thus, to collect the whole statistics with pg_stat_monitor, we recommend to specify the extensions as follows: ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_statements, pg_stat_monitor'.
|
||||||
|
|
||||||
|
Start or restart the `postgresql` instance to apply the changes.
|
||||||
|
|
||||||
|
* On Debian and Ubuntu:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo systemctl restart postgresql.service
|
||||||
|
```
|
||||||
|
|
||||||
|
* On Red Hat Enterprise Linux and CentOS:
|
||||||
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo systemctl restart postgresql-13
|
||||||
|
```
|
||||||
|
|
||||||
|
Create the extension using the [CREATE EXTENSION](https://www.postgresql.org/docs/current/sql-createextension.html) command. Using this command requires the privileges of a superuser or a database owner. Connect to `psql` as a superuser for a database and run the following command:
|
||||||
|
|
||||||
|
|
||||||
|
```sql
|
||||||
|
CREATE EXTENSION pg_stat_monitor;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
This allows you to see the stats collected by `pg_stat_monitor`.
|
||||||
|
|
||||||
|
By default, `pg_stat_monitor` is created for the `postgres` database. To access the statistics from other databases, you need to create the extension for every database.
|
||||||
|
|
||||||
|
```
|
||||||
|
-- Select some of the query information, like client_ip, username and application_name etc.
|
||||||
|
|
||||||
|
postgres=# SELECT application_name, userid AS user_name, datname AS database_name, substr(query,0, 50) AS query, calls, client_ip
|
||||||
|
FROM pg_stat_monitor;
|
||||||
|
application_name | user_name | database_name | query | calls | client_ip
|
||||||
|
------------------+-----------+---------------+---------------------------------------------------+-------+-----------
|
||||||
|
psql | vagrant | postgres | SELECT application_name, userid::regrole AS user_ | 1 | 127.0.0.1
|
||||||
|
psql | vagrant | postgres | SELECT application_name, userid AS user_name, dat | 3 | 127.0.0.1
|
||||||
|
psql | vagrant | postgres | SELECT application_name, userid AS user_name, dat | 1 | 127.0.0.1
|
||||||
|
psql | vagrant | postgres | SELECT application_name, userid AS user_name, dat | 8 | 127.0.0.1
|
||||||
|
psql | vagrant | postgres | SELECT bucket, substr(query,$1, $2) AS query, cmd | 1 | 127.0.0.1
|
||||||
|
(5 rows)
|
||||||
|
```
|
||||||
|
|
||||||
|
To learn more about `pg_stat_monitor` features and usage, see [User Guide](https://github.com/percona/pg_stat_monitor/blob/master/docs/USER_GUIDE.md). To view all other data elements provided by `pg_stat_monitor`, please see the [`pg_stat_monitor` view reference](REREFENCE.md).
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
You can find the configuration parameters of the `pg_stat_monitor` extension in the `pg_stat_monitor_settings` view. To change the default configuration, specify new values for the desired parameters using the GUC (Grant Unified Configuration) system. To learn more, refer to the [Configuration](https://github.com/percona/pg_stat_monitor/blob/master/docs/USER_GUIDE.md#configuration) section of the user guide.
|
||||||
|
|
||||||
|
## Remove `pg_stat_monitor`
|
||||||
|
|
||||||
|
To uninstall `pg_stat_monitor`, do the following:
|
||||||
|
|
||||||
|
1. Disable statistics collection. Establish the `psql` session and run the following command :
|
||||||
|
|
||||||
|
```sql
|
||||||
|
ALTER SYSTEM SET pg_stat_monitor.pgsm_enable = 0;
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Drop `pg_stat_monitor` extension:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
DROP EXTENSION pg_stat_monitor;
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Remove `pg_stat_monitor` from the `shared_preload_libraries` configuration parameter:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
ALTER SYSTEM SET shared_preload_libraries = '';
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! important
|
||||||
|
|
||||||
|
If the `shared_preload_libraries` parameter includes other modules, specify them all for the `ALTER SYSTEM SET` command to keep using them.
|
||||||
|
|
||||||
|
4. Restart the `postgresql` instance to apply the changes. The following command restarts PostgreSQL 13. Replace the version value with the one you are using.
|
||||||
|
|
||||||
|
* On Debian and Ubuntu:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo systemctl restart postgresql.service
|
||||||
|
```
|
||||||
|
|
||||||
|
* On Red Hat Enterprise Linux and CentOS:
|
||||||
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo systemctl restart postgresql-13
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
# MkDocs configuration for Netlify builds
|
||||||
|
|
||||||
|
site_name: pg_stat_monitor Documentation
|
||||||
|
site_description: Documentation
|
||||||
|
site_author: Percona LLC
|
||||||
|
copyright: Percona LLC, © 2022
|
||||||
|
|
||||||
|
repo_name: percona/pg_stat_monitor
|
||||||
|
repo_url: https://github.com/percona/pg_stat_monitor
|
||||||
|
edit_uri: edit/master/docs/
|
||||||
|
|
||||||
|
use_directory_urls: false
|
||||||
|
|
||||||
|
# Theme for netlify testing
|
||||||
|
theme:
|
||||||
|
name: material
|
||||||
|
logo: _images/percona-logo.svg
|
||||||
|
favicon: _images/percona-favicon.ico
|
||||||
|
palette:
|
||||||
|
|
||||||
|
# Light mode
|
||||||
|
- media: "(prefers-color-scheme: light)"
|
||||||
|
scheme: percona-light
|
||||||
|
toggle:
|
||||||
|
icon: material/toggle-switch-off-outline
|
||||||
|
name: Switch to dark mode
|
||||||
|
|
||||||
|
# Dark mode
|
||||||
|
- media: "(prefers-color-scheme: dark)"
|
||||||
|
scheme: slate
|
||||||
|
toggle:
|
||||||
|
icon: material/toggle-switch
|
||||||
|
name: Switch to light mode
|
||||||
|
|
||||||
|
# Theme features
|
||||||
|
|
||||||
|
features:
|
||||||
|
- search.highlight
|
||||||
|
- navigation.top
|
||||||
|
|
||||||
|
|
||||||
|
extra_css:
|
||||||
|
- https://unicons.iconscout.com/release/v3.0.3/css/line.css
|
||||||
|
- https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css
|
||||||
|
- css/version-select.css
|
||||||
|
- css/toctree.css
|
||||||
|
- css/percona.css
|
||||||
|
|
||||||
|
extra_javascript:
|
||||||
|
- js/version-select.js
|
||||||
|
|
||||||
|
markdown_extensions:
|
||||||
|
- attr_list
|
||||||
|
- toc:
|
||||||
|
permalink: True
|
||||||
|
- admonition
|
||||||
|
- footnotes
|
||||||
|
- def_list # https://michelf.ca/projects/php-markdown/extra/#def-list
|
||||||
|
- meta
|
||||||
|
- smarty:
|
||||||
|
smart_angled_quotes: true
|
||||||
|
- pymdownx.mark
|
||||||
|
- pymdownx.smartsymbols
|
||||||
|
- pymdownx.tabbed
|
||||||
|
- pymdownx.tilde
|
||||||
|
- pymdownx.superfences
|
||||||
|
- pymdownx.highlight:
|
||||||
|
linenums: false
|
||||||
|
- pymdownx.emoji:
|
||||||
|
emoji_index: !!python/name:materialx.emoji.twemoji
|
||||||
|
emoji_generator: !!python/name:materialx.emoji.to_svg
|
||||||
|
#- plantuml_markdown
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- search
|
||||||
|
- git-revision-date
|
||||||
|
- section-index # Adds links to nodes - comment out when creating PDF
|
||||||
|
# - htmlproofer # Uncomment to check links - but extends build time significantly
|
||||||
|
- mike:
|
||||||
|
version_selector: true
|
||||||
|
css_dir: css
|
||||||
|
javascript_dir: js
|
||||||
|
canonical_version: null
|
||||||
|
|
||||||
|
|
||||||
|
extra:
|
||||||
|
version:
|
||||||
|
provider: mike
|
||||||
|
|
||||||
|
nav:
|
||||||
|
- index.md
|
||||||
|
- setup.md
|
||||||
|
- User guide:
|
||||||
|
- USER_GUIDE.md
|
||||||
|
- REFERENCE.md
|
||||||
|
- COMPARISON.md
|
||||||
|
- Release notes:
|
||||||
|
- RELEASE_NOTES.md
|
||||||
|
# - Version Selector: "../"
|
Loading…
Reference in New Issue