Readyset Weekly: Issue 2
Why Autovacuum Might Be Slowing You Down and How to Fix It
Autovacuum keeps PostgreSQL healthy by cleaning up dead tuples, reclaiming storage, maintaining index efficiency, and preventing transaction ID wraparound. However, when it falls behind or isn’t tuned, bloat accumulates, degrading query performance and even threatening data integrity. Here’s how you can fix it:
- Vacuum sooner: Lower
autovacuum_vacuum_scale_factor(e.g., 0.2 → 0.05) to trigger cleanup earlier and prevent bloat buildup. - Vacuum faster: Raise
autovacuum_vacuum_cost_limit(e.g., 200 → 1000) and lowerautovacuum_vacuum_cost_delay(e.g., 20ms → 5ms) to reduce cleanup lag. - Prioritize critical tables: Use
ALTER TABLEto fine-tune autovacuum thresholds and cost limits on high-write or high-read tables. - Monitor and react: Use views like
pg_stat_user_tablesandpg_stat_all_tablesto watch forhigh n_dead_tupcounts or long gaps inlast_autovacuum. - Leverage parallel vacuum (PostgreSQL 13+): For very large tables, increase
maintenance_work_memand useVACUUM (PARALLEL ...)to reduce vacuum runtimes. - Keep index bloat in check: Use tools like pgstattuple to measure index bloat, and schedule regular
REINDEXoperations on bloated indexes. - Align with workload patterns: Tune autovacuum or run manual vacuums during off-peak hours to avoid competing with production traffic.
These adjustments aren’t one-size-fits-all, but they’re great starting points. Want more tuning tips? Check out this list of great resources.
🔍 What We’re Watching in the Database Ecosystem
BigQuery’s Pricing Surprises: How 22 Seconds Cost $10K This cautionary tale shows how BigQuery’s pricing model can turn a simple query into a $10K bill. It’s a reminder of the importance of understanding cloud and warehouse billing models, and a quiet case for caching the high-cost stuff closer to your app.
Comparing Modern Analytics Engines: Spark, ClickHouse, Presto, StarRocks, Trino This head-to-head benchmark tests popular MPP engines across latency, concurrency, and cost. The results reinforce what most engineers already suspect: there’s no one-size-fits-all engine, each system shines under specific conditions.
MySQL At Uber Uber runs over 2,300 MySQL clusters, relying on a custom-built control plane to handle failovers, upgrades, and consistency at scale. It's an impressive feat, but also a reminder that scaling MySQL without the right tooling can quickly become a full-time engineering problem.
In Case You Missed It
🤝 Partnership Announcement: We’re thrilled to share that we’ve partnered with PerformanceDB, a leading database support and service provider with the goal of better serving our customers across Brazil. Check out the full announcement here.
🔦 Customer Spotlight: Grupo Ótima Digital, a leading provider of unified messaging solutions in Brazil, reduced its MySQL database load by over 30% overnight with Readyset. Check out our full case study to find out how.
🗓️ Mark your calendar: The Readyset team is headed to Berlin for PGConf Germany on May 8th and 9th. If you’re attending or in the area, let us know, we’d love to connect on all things databases.
Get Readyset Weekly in your inbox
One email a week — what shipped, what we learned, and what is worth reading.