SShortSingh.
Back to feed

PostgreSQL Index Bloat: Why VACUUM Won't Shrink Indexes and How to Fix It

0
·86 views

A PostgreSQL database was found to have indexes up to six times larger than the heap data they referenced, with one table's 4.6 GB heap carrying 30 GB of indexes. Standard VACUUM only marks dead index entries as reusable and reclaims fully empty pages, but sparse b-tree pages with even one surviving key remain allocated indefinitely since b-trees do not merge sparse neighbours. The recommended fix is REINDEX INDEX CONCURRENTLY run one index at a time, which avoids locking the table and limits peak extra disk usage to the size of one new index. Index bloat can be measured using pgstatindex's avg_leaf_density field, with values significantly below the 90% b-tree default fillfactor indicating bloat, and recovered space can be estimated as current_size multiplied by density divided by 90. VACUUM FULL is the wrong remedy for index bloat as it targets heap bloat, requires an ACCESS EXCLUSIVE lock, and needs free space equal to the entire table size.

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
ProgrammingHacker News ·

Developer urges locking down GitHub Actions workflows

A blog post by developer Hugo van Kemenade, published in 2026, advises readers to lock their GitHub Actions configurations. The article, shared on Hacker News, is presented as a guide to securing CI/CD workflows. The post had gathered six points and one comment on the forum at the time of the listing. The available text provides only the link and metadata, so the specific recommendations are not detailed here.

0
ProgrammingHacker News ·

Report Says Nvidia CEO Jensen Huang Had Relationship With Company Executive

A New York Times report alleges that Nvidia CEO Jensen Huang had a personal relationship with an executive at the chipmaker. The article was published on November 11, 2026, and was shared on Hacker News, where it drew 38 points and 23 comments. The available text provides only the headline and link metadata, so the specific details, sourcing, and any company or personal response cannot be confirmed from this item. Readers seeking the full account should consult the original New York Times article.

0
ProgrammingDEV Community ·

Year-End Invoicing Checklist: Timing Tasks Before and After December

Year-end administration often falls behind because it collides with the busy December period, when clients slow down and leftover work piles up. The recommended approach is to sequence tasks: first pursue money that can still be collected before the year closes, then tidy records while there is time to locate missing items. Priorities include billing completed but unbilled work, ranking receivables by age, and separating disputed invoices from merely late ones. Afterward, the focus shifts to checking invoice numbering, storing every issued invoice as a consistently named file, verifying client details, and reconciling partial payments. The checklist is framed as deadlines relative to a business's own year-end, since requirements vary by jurisdiction and entity type.

0
ProgrammingDEV Community ·

Four Agency Billing Models and the Unbilled Work Most Firms Miss

Agency invoices must satisfy clients, procurement, and the agency's own cash flow, and most problems stem from unstated rules. The article outlines four billing approaches: retainers billed in advance or arrears, milestone or fixed fees, and time-and-materials. It stresses that each invoice should tie directly to a contract clause or an approved deliverable, with approval details recorded. Pass-through costs should be billed at cost on separate lines with supporting third-party invoices, and any markup agreed upfront. The piece also flags the unbilled work agencies often overlook, along with client-specific invoicing requirements that should be documented once and reused.