Urgent.News

What's breaking now, across thousands of outlets.

Tech

PostgreSQL VACUUM Monitoring: Stop Table Bloat Before It Hurts

Originally published on kuryzhev.cloud Without PostgreSQL VACUUM monitoring, a busy table can degrade for weeks before anyone notices. Consider a typical failure: a high-churn orders table in a mid-sized production database. Queries that took milliseconds in the spring now take seconds. Disk usage on the volume grows steadily even though the row count is flat. Someone checks the dashboards, and…

In the world of PostgreSQL databases, a troubling issue known as table bloat can silently degrade performance for weeks before anyone takes notice. A prime example is a frequently updated "orders" table in a mid-sized production database. What once took mere milliseconds to execute now lags seconds, and even though the row count remains unchanged, disk usage steadily increases.

Despite all seemingly being in order, alert notifications eventually arrive, revealing a slow-growing disk, sluggish index scans, and timeouts during routine deployments that involve adding a new column. Even though autovacuum was actively running, it failed to keep up with the bloat or was unable to finish its task.

The narrative of this story aligns with the behavior described by the PostgreSQL documentation, stemming from the inherent MVCC (Multiversion Concurrency Control) mechanism. In this system, UPDATE and DELETE operations retain previous row versions, only to have VACUUM reclaim that space when no longer needed. However, plain VACUUM seldom shrinks the table file, particularly when empty pages are scattered throughout.

Persistent bloat can be attributed to several factors, including default settings that scale poorly, old snapshots hindering cleanup, and throttled autovacuum workers.

The consequences of this issue are gradual and indirect, often leading teams to mistakenly attribute the problem to a need for a larger instance. Symptoms include disk growth without accompanying data increase, expanding table and index files, slow query performance due to sequential scans of pages filled with dead rows, and increased cache pressure as bloated pages occupy shared buffers and the OS page cache.

Frequent autovacuum activity may also be observed, with workers appearing in pg_stat_activity for extended periods, yet failing to improve the situation. In the worst-case scenario, warnings about databases requiring vacuuming within a limited time frame of transactions may appear in the logs.

To address this issue, proactive PostgreSQL VACUUM monitoring and per-table tuning are essential. By implementing a measurement query to rank tables by dead-tuple pressure and track autovacuum history, teams can gain insight into the problem's severity. Additionally, analyzing which transactions are holding back the cleanup horizon, identifying standbys with hot_standby_feedback, and monitoring replication slots and prepared transactions can help pinpoint the root causes of bloat.

For a more precise measurement on specific tables, the pgstattuple extension can be utilized, although it comes with increased I/O costs.

To mitigate table bloat, it is advisable to tune individual tables rather than altering global settings. Adjusting autovacuum triggers to fire earlier and allowing it to perform more work per cost cycle before sleeping can significantly alleviate the issue. Fine-tuning these parameters according to the specific requirements of each table ensures optimal performance and prevents the gradual decay of the database.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

We collected 1,045 hours of sleep audio. Only 53 hours were usable for training.

We have 1,045 hours of overnight bedroom audio. For training a sleep-phase model, about 53 of those hours are usable. That ratio is the least glamorous number in this project and probably the most…

  • 1,045 hours of sleep audio collected for model training
  • Only 53 hours of audio deemed usable for training
  • Strict criteria resulted in 20:1 ratio of collected to usable data

A copyable MCP tool-cost check for CI, with passing and failing examples

A tool's description can shrink while its schema grows. A single token total can hide that regression. Here is a complete example that checks the total, descriptions and input schemas separately, then…

  • Tool cost regression detected by CI check
  • HISTOR tool lists verified for expected counts and digests
  • CI integration with baseline snapshot for ongoing monitoring

Why PDF image extractors return the stored picture, not the one on the page

Every extractor I pointed at my test PDF gave me back a rotated picture unrotated and a half-hidden picture whole. After three years of codec work I took that as the correct answer, but I wanted to be…

  • PDF image extractors return stored picture, not visible page image
  • Tools like pdfimages, PyMuPDF, pdf.js show stored pixels
  • D image returns page colors, applying /Decode and ignoring clip

PAN-OS October 2026 batch: how CVE-2026-0321 differs from its siblings

PAN-OS October 2026 batch: how CVE-2026-0321 differs from its siblings Palo Alto Networks shipped a cluster of advisories in mid-October 2026, and CERT-FR bundled them into advisory…

  • CVE-2026-0321 is an unauthenticated vulnerability in PAN-OS October 2026
  • Denial-of-service condition can occur via crafted network traffic
  • CVSS score of 6.6 indicates moderate severity despite unauthenticated access

More from Sunday 25 October →