Postgres VACUUM Command Generator
Compose the right PostgreSQL VACUUM command instead of guessing at options. Pick plain VACUUM, VACUUM ANALYZE, VACUUM FULL or ANALYZE, scope it to one table or the whole database, and toggle VERBOSE, FREEZE, SKIP_LOCKED, PARALLEL workers, INDEX_CLEANUP and TRUNCATE behaviour. The generator emits the SQL command and the equivalent vacuumdb shell command, plus ready-to-run monitoring queries (vacuum progress, dead-tuple counts, transaction-ID wraparound headroom) and per-table autovacuum tuning DDL so manual vacuums become rare. It also warns you when an option is dangerous — like the exclusive lock VACUUM FULL takes. Runs entirely in your browser.
Do more than postgres vacuum command generator — meet Chat2DB
Chat2DB is an AI-powered SQL client for Windows, macOS and Linux. Write SQL in natural language, format and optimize queries automatically, and manage MySQL, PostgreSQL, Oracle and 20+ other databases in one workspace.
How to use
- Choose the mode — VACUUM, VACUUM ANALYZE, VACUUM FULL or ANALYZE — and whether it targets one table or the whole database.
- Toggle options like VERBOSE, FREEZE, SKIP_LOCKED, PARALLEL workers or INDEX_CLEANUP, and read the warnings the tool raises for risky combinations.
- Copy the generated command, use the monitoring queries to watch progress and dead tuples, and apply the autovacuum tuning DDL to stop the bloat from coming back.
Frequently asked questions
What does VACUUM actually do in PostgreSQL?
PostgreSQL never overwrites rows in place: UPDATE and DELETE leave dead tuples behind. VACUUM scans the table, marks that dead space reusable for future writes, updates the visibility map, and freezes old transaction IDs to prevent wraparound. Plain VACUUM runs alongside normal reads and writes and does not return space to the operating system (except trailing empty pages). VACUUM ANALYZE additionally refreshes the planner statistics that query plans depend on.
When should I use VACUUM FULL?
Almost never on a live system. VACUUM FULL rewrites the entire table into a new file, which does return disk space to the OS, but it holds an ACCESS EXCLUSIVE lock the whole time — every query on the table blocks — and needs enough free disk for a full copy. It is reasonable after deleting most of a table's rows during a maintenance window. Otherwise fix autovacuum so bloat never accumulates, or use pg_repack, which compacts the table with only brief locks.
Why is autovacuum not keeping up with my table?
The default trigger is 20% dead tuples (autovacuum_vacuum_scale_factor = 0.2), which on a 100-million-row table means 20 million dead rows before autovacuum even starts, and cost-based throttling then makes it run slowly. Lower the scale factor per table (e.g. 0.05), reduce autovacuum_vacuum_cost_delay, and check for long-running transactions or abandoned replication slots that prevent dead tuples from being removed at all. To run these diagnostics against a live database, Chat2DB is a free AI database client — download it at https://chat2db.ai/download or use https://app.chat2db.ai in the browser.
