SShortSingh.
Back to feed

How PostgreSQL Handles Table Bloat: Autovacuum, VACUUM, and VACUUM FULL Explained

0
·7 views

PostgreSQL does not immediately remove old row versions after updates or deletions, instead relying on MVCC, which can cause tables to accumulate dead tuples and consume excess disk space. Three mechanisms address this bloat: Autovacuum runs automatically in the background to mark dead tuple space as reusable without locking the table, while manual VACUUM does the same on demand. VACUUM FULL goes further by physically rebuilding the table with only live rows and returning unused space to the OS, but requires an exclusive lock that blocks all concurrent access. A demonstration using a 2-million-row table showed that deleting 1.8 million rows left the physical table size unchanged at 1116 MB until a vacuum operation ran. This highlights that reclaiming actual disk space in PostgreSQL requires deliberate use of the appropriate vacuum strategy depending on downtime tolerance and storage needs.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

PostgreSQL Advisory Locks Offer a Built-In Fix for Distributed Race Conditions

Race conditions in clustered applications occur when multiple pods process the same request simultaneously, leading to errors like duplicate payouts or double-credited rewards. Common fixes such as Java's synchronized keyword fail in multi-pod deployments, while row-level database locks require a pre-existing row and can cause storage overhead. Introducing a separate Redis cluster adds operational complexity and potential split-brain failure risks. PostgreSQL Advisory Locks provide an alternative by letting applications define integer-keyed locks held directly in the database server's memory, with no row or table attachment. Since most teams already rely on PostgreSQL as their primary datastore, this approach eliminates the need for additional infrastructure while effectively serializing critical operations across pods.

0
ProgrammingDEV Community ·

CrawlForge MCP fixes residential proxy routing across six releases in eleven days

Developer tool CrawlForge MCP released six updates between September 16 and 27, 2026, after discovering that residential proxy routing was misconfigured and failing to bypass Cloudflare bot detection. An internal benchmark against version 6.6.2 exposed the flaw, triggering a rapid series of fixes. The updates introduced a multi-stage escalation ladder that progresses from a plain fetch to a Chrome TLS handshake to a stealth browser, stopping at whichever step successfully retrieves the page. A clearance jar was added to cache solved Cloudflare challenges, preventing repeated solving on subsequent requests. No tools were renamed, no prices changed for most tiers, and the team stated it would not implement CAPTCHA solving or token forgery, with robots.txt checked at every escalation stage.

0
ProgrammingDEV Community ·

How developers can convert e-commerce reviews into actionable defect tables for free

A software developer has shared a technical walkthrough for transforming unstructured product reviews from platforms like Amazon and TikTok Shop into structured defect tables without paid APIs or scraping tools. The method addresses common pitfalls such as lazy-loading review widgets, pagination loops that return duplicate results, and CSV encoding issues that corrupt non-Latin text. Instead of relying on star ratings, the approach clusters one-to-three star reviews into six complaint categories — including packaging damage, wrong sizing, and counterfeit concerns — using simple keyword matching rather than machine learning models. The resulting defect table allows merchants to benchmark their products against competitors across specific complaint types. The developer argues this turns vague quality feedback into concrete, prioritised product improvements.

0
ProgrammingDEV Community ·

Dev builds bilingual browser cooking game using Astro and Cloudflare edge caching

A developer has launched Cá Viên Chiên, a mobile-friendly browser game about Vietnamese fried fish ball street carts, available in both English and Vietnamese. Built with Astro, the project uses a single vanilla JavaScript island of around 26 KB with no framework runtime, keeping the site lightweight and SEO-friendly via static HTML pages. Game progress is saved to localStorage and transferred between devices using a copy-paste save code, requiring no backend or user accounts. The main technical challenge was caching HTML at Cloudflare's edge, as pages initially showed dynamic responses with high origin latency despite cache rules being in place. The fix involved using the CDN-Cache-Control header to set a 24-hour edge TTL independently of browser cache headers, with cache purges triggered on each deployment to ensure fresh content.