pg_stat_monitor/main/index.html

631 lines
23 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Documentation">
<meta name="author" content="Percona LLC">
<link rel="icon" href="_images/percona-favicon.ico">
<meta name="generator" content="mkdocs-1.2.3, mkdocs-material-8.1.9">
<title>pg_stat_monitor Documentation</title>
<link rel="stylesheet" href="assets/stylesheets/main.2b4465f4.min.css">
<link rel="stylesheet" href="assets/stylesheets/palette.e6a45f82.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v3.0.3/css/line.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/version-select.css">
<link rel="stylesheet" href="css/toctree.css">
<link rel="stylesheet" href="css/percona.css">
<script>__md_scope=new URL(".",location),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="percona-light" data-md-color-primary="" data-md-color-accent="">
<script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#welcome" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<div data-md-component="outdated" hidden>
<aside class="md-banner md-banner--warning">
</aside>
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="index.html" title="pg_stat_monitor Documentation" class="md-header__button md-logo" aria-label="pg_stat_monitor Documentation" data-md-component="logo">
<img src="_images/percona-logo.svg" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
pg_stat_monitor Documentation
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Welcome
</span>
</div>
</div>
</div>
<form class="md-header__option" data-md-component="palette">
<input class="md-option" data-md-color-media="(prefers-color-scheme: light)" data-md-color-scheme="percona-light" data-md-color-primary="" data-md-color-accent="" aria-label="Switch to dark mode" type="radio" name="__palette" id="__palette_1">
<label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_2" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>
</label>
<input class="md-option" data-md-color-media="(prefers-color-scheme: dark)" data-md-color-scheme="slate" data-md-color-primary="" data-md-color-accent="" aria-label="Switch to light mode" type="radio" name="__palette" id="__palette_2">
<label class="md-header__button md-icon" title="Switch to light mode" for="__palette_1" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h10a5 5 0 0 0 5-5 5 5 0 0 0-5-5m0 8a3 3 0 0 1-3-3 3 3 0 0 1 3-3 3 3 0 0 1 3 3 3 3 0 0 1-3 3z"/></svg>
</label>
</form>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/percona/pg_stat_monitor/" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
</div>
<div class="md-source__repository">
percona/pg_stat_monitor
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="index.html" title="pg_stat_monitor Documentation" class="md-nav__button md-logo" aria-label="pg_stat_monitor Documentation" data-md-component="logo">
<img src="_images/percona-logo.svg" alt="logo">
</a>
pg_stat_monitor Documentation
</label>
<div class="md-nav__source">
<a href="https://github.com/percona/pg_stat_monitor/" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
</div>
<div class="md-source__repository">
percona/pg_stat_monitor
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
Welcome
<span class="md-nav__icon md-icon"></span>
</label>
<a href="index.html" class="md-nav__link md-nav__link--active">
Welcome
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#how-pg_stat_monitor-works" class="md-nav__link">
How pg_stat_monitor works?
</a>
</li>
<li class="md-nav__item">
<a href="#features" class="md-nav__link">
Features
</a>
</li>
<li class="md-nav__item">
<a href="#availability" class="md-nav__link">
Availability
</a>
<nav class="md-nav" aria-label="Availability">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#supported-versions" class="md-nav__link">
Supported versions
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#get-started" class="md-nav__link">
Get started
</a>
</li>
<li class="md-nav__item">
<a href="#read-more" class="md-nav__link">
Read more
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="setup.html" class="md-nav__link">
Setting up `pg_stat_monitor`
</a>
</li>
<li class="md-nav__item">
<a href="USER_GUIDE.html" class="md-nav__link">
User guide
</a>
</li>
<li class="md-nav__item">
<a href="REFERENCE.html" class="md-nav__link">
`pg_stat_monitor` view reference
</a>
</li>
<li class="md-nav__item">
<a href="COMPARISON.html" class="md-nav__link">
Comparing pg_stat_monitor and pg_stat_statements
</a>
</li>
<li class="md-nav__item">
<a href="RELEASE_NOTES.html" class="md-nav__link">
Release notes
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#how-pg_stat_monitor-works" class="md-nav__link">
How pg_stat_monitor works?
</a>
</li>
<li class="md-nav__item">
<a href="#features" class="md-nav__link">
Features
</a>
</li>
<li class="md-nav__item">
<a href="#availability" class="md-nav__link">
Availability
</a>
<nav class="md-nav" aria-label="Availability">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#supported-versions" class="md-nav__link">
Supported versions
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#get-started" class="md-nav__link">
Get started
</a>
</li>
<li class="md-nav__item">
<a href="#read-more" class="md-nav__link">
Read more
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<a href="https://github.com/percona/pg_stat_monitor/edit/master/docs/index.md" title="Edit this page" class="md-content__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg>
</a>
<h1 id="welcome">Welcome<a class="headerlink" href="#welcome" title="Permanent link">&para;</a></h1>
<p>The <strong>pg_stat_monitor</strong> is a <strong><em>Query Performance Monitoring</em></strong> 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. </p>
<h2 id="how-pg_stat_monitor-works">How <code>pg_stat_monitor</code> works?<a class="headerlink" href="#how-pg_stat_monitor-works" title="Permanent link">&para;</a></h2>
<p><code>pg_stat_monitor</code> is developed on the basis of <code>pg_stat_statements</code> as its more advanced replacement. While <code>pg_stat_statements</code> provides ever-increasing metrics, <code>pg_stat_monitor</code> aggregates the collected data, saving user efforts for doing it themselves. <code>pg_stat_monitor</code> stores statistics in configurable time-based units – <em>buckets</em>. 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.</p>
<h2 id="features">Features<a class="headerlink" href="#features" title="Permanent link">&para;</a></h2>
<ul>
<li><strong>Time Interval Grouping:</strong> Instead of supplying one set of ever-increasing counts, <code>pg_stat_monitor</code> 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.</li>
<li><strong>Multi-Dimensional Grouping:</strong> While <code>pg_stat_statements</code> groups counters by userid, dbid, queryid, <code>pg_stat_monitor</code> uses a more detailed group for higher precision. This allows a user to drill down into the performance of queries.</li>
<li><strong>Capture Actual Parameters in the Queries:</strong> <code>pg_stat_monitor</code> 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.</li>
<li><strong>Query Plan:</strong> Each SQL is now accompanied by its actual plan that was constructed for its execution. That&rsquo;s a huge advantage if you want to understand why a particular query is slower than expected.</li>
<li><strong>Tables Access Statistics for a Statement:</strong> This allows us to easily identify all queries that accessed a given table. This set is at par with the information provided by the <code>pg_stat_statements</code>.</li>
<li><strong>Histogram:</strong> 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.</li>
</ul>
<h2 id="availability">Availability<a class="headerlink" href="#availability" title="Permanent link">&para;</a></h2>
<p><code>pg_stat_monitor</code> supports PostgreSQL versions 11 and above. It is compatible with both PostgreSQL provided by PostgreSQL Global Development Group (PGDG) and <a href="https://www.percona.com/software/postgresql-distribution">Percona Distribution for PostgreSQL</a>.</p>
<h3 id="supported-versions">Supported versions<a class="headerlink" href="#supported-versions" title="Permanent link">&para;</a></h3>
<p>The <code>pg_stat_monitor</code> should work on the latest version of both <a href="https://www.percona.com/software/postgresql-distribution">Percona Distribution for PostgreSQL</a> and PostgreSQL, but is only tested with these versions:</p>
<table>
<thead>
<tr>
<th><strong>Distribution</strong></th>
<th><strong>Version</strong></th>
<th><strong>Provider</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://www.percona.com/software/postgresql-distribution">Percona Distribution for PostgreSQL</a></td>
<td><a href="https://www.percona.com/downloads/percona-postgresql-11/LATEST/">11</a>, <a href="https://www.percona.com/downloads/postgresql-distribution-12/LATEST/">12</a>, <a href="https://www.percona.com/downloads/postgresql-distribution-13/LATEST/">13</a> and <a href="https://www.percona.com/downloads/postgresql-distribution-14/LATEST/">14</a></td>
<td>Percona</td>
</tr>
<tr>
<td>PostgreSQL</td>
<td>11, 12, 13 and 14</td>
<td>PostgreSQL Global Development Group (PGDG)</td>
</tr>
</tbody>
</table>
<p>The RPM (for RHEL and CentOS) and the DEB (for Debian and Ubuntu) packages are available from Percona repositories for PostgreSQL versions <a href="https://www.percona.com/downloads/percona-postgresql-11/LATEST/">11</a>, <a href="https://www.percona.com/downloads/postgresql-distribution-12/LATEST/">12</a>, <a href="https://www.percona.com/downloads/postgresql-distribution-13/LATEST/">13</a> and <a href="https://www.percona.com/downloads/postgresql-distribution-14/LATEST/">14</a>.</p>
<p>The RPM packages are also available in the official PostgreSQL (PGDG) <code>yum</code> repositories.</p>
<h2 id="get-started">Get started<a class="headerlink" href="#get-started" title="Permanent link">&para;</a></h2>
<ul>
<li>Use the <a href="setup.html">installation guidelines</a> to install and set up <code>pg_stat_monitor</code>.</li>
<li>Refer to the <a href="USER_GUIDE.html">User guide</a> for details about available features and functions, usage examples and configuration parameters.</li>
</ul>
<h2 id="read-more">Read more<a class="headerlink" href="#read-more" title="Permanent link">&para;</a></h2>
<ul>
<li><a href="REREFENCE.md"><code>pg_stat_monitor</code> view reference</a></li>
<li><a href="COMPARE.md">pg_stat_monitor and pg_stat_statements comparison</a></li>
</ul>
<hr>
<div class="md-source-file">
<small>
Last update:
2022-01-19
</small>
</div>
</article>
</div>
</div>
<a href="#" class="md-top md-icon" data-md-component="top" data-md-state="hidden">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"/></svg>
Back to top
</a>
</main>
<footer class="md-footer">
<nav class="md-footer__inner md-grid" aria-label="Footer">
<a href="setup.html" class="md-footer__link md-footer__link--next" aria-label="Next: Setting up `pg_stat_monitor`" rel="next">
<div class="md-footer__title">
<div class="md-ellipsis">
<span class="md-footer__direction">
Next
</span>
Setting up `pg_stat_monitor`
</div>
</div>
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
</div>
</a>
</nav>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
<div class="md-copyright__highlight">
Percona LLC, &#169; 2022
</div>
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": ".", "features": ["search.highlight", "navigation.top"], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "search": "assets/javascripts/workers/search.22074ed6.min.js", "version": {"provider": "mike"}}</script>
<script src="assets/javascripts/bundle.960e086b.min.js"></script>
<script src="js/version-select.js"></script>
</body>
</html>