<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Performance Monitoring on Postgres Scripts</title><link>https://www.postgresscripts.com/tags/performance-monitoring/</link><description>Recent content in Performance Monitoring on Postgres Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>PostgresScripts.com</copyright><lastBuildDate>Sun, 17 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.postgresscripts.com/tags/performance-monitoring/index.xml" rel="self" type="application/rss+xml"/><item><title>Monitor PostgreSQL Wait Events Using pg_stat_activity</title><link>https://www.postgresscripts.com/post/monitor-postgresql-wait-events-pg-stat-activity/</link><pubDate>Sun, 17 May 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/monitor-postgresql-wait-events-pg-stat-activity/</guid><description>
&lt;h2 id="understanding-postgresql-wait-events-for-performance-analysis"&gt;Understanding PostgreSQL Wait Events for Performance Analysis&lt;/h2&gt;
&lt;p&gt;Every active PostgreSQL backend is either executing work or waiting. When a session waits, PostgreSQL records the reason in &lt;code&gt;pg_stat_activity&lt;/code&gt; using two columns: &lt;code&gt;wait_event_type&lt;/code&gt; and &lt;code&gt;wait_event&lt;/code&gt;. Aggregating these across all sessions gives a clear picture of where your database is spending idle time — and what is holding it back.&lt;/p&gt;
&lt;p&gt;Common wait event types include &lt;code&gt;Lock&lt;/code&gt; (heavyweight locks between transactions), &lt;code&gt;LWLock&lt;/code&gt; (internal lightweight locks), &lt;code&gt;IO&lt;/code&gt; (disk reads and writes), &lt;code&gt;IPC&lt;/code&gt; (inter-process communication), and &lt;code&gt;Client&lt;/code&gt; (waiting on application input). A cluster dominated by &lt;code&gt;IO&lt;/code&gt; waits may need larger &lt;code&gt;shared_buffers&lt;/code&gt;; a cluster dominated by &lt;code&gt;Lock&lt;/code&gt; waits has contention between transactions that needs investigation at the query level.&lt;/p&gt;</description></item><item><title>Monitor PostgreSQL Vacuum Progress with pg_stat_progress_vacuum</title><link>https://www.postgresscripts.com/post/monitor-postgresql-vacuum-progress-pg-stat-progress-vacuum/</link><pubDate>Sat, 16 May 2026 00:00:00 +0000</pubDate><guid>https://www.postgresscripts.com/post/monitor-postgresql-vacuum-progress-pg-stat-progress-vacuum/</guid><description>
&lt;h2 id="tracking-active-vacuum-and-autovacuum-workers-in-postgresql"&gt;Tracking Active Vacuum and Autovacuum Workers in PostgreSQL&lt;/h2&gt;
&lt;p&gt;PostgreSQL vacuum is the maintenance process that removes dead tuples left behind by updates and deletes, reclaims storage, and prevents transaction ID wraparound. On active databases, autovacuum runs continuously in the background, but knowing whether it is actually making progress — and on which tables — requires querying the &lt;code&gt;pg_stat_progress_vacuum&lt;/code&gt; view.&lt;/p&gt;
&lt;p&gt;Introduced in PostgreSQL 9.6, &lt;code&gt;pg_stat_progress_vacuum&lt;/code&gt; exposes one row per active vacuum worker, including both manual &lt;code&gt;VACUUM&lt;/code&gt; commands and autovacuum background workers. The view shows the current phase, block counts scanned and vacuumed, and dead tuple statistics. This is the primary tool for answering the operational question: is vacuum keeping up, and if not, where is it stuck?&lt;/p&gt;</description></item></channel></rss>