forgedb compact

Inspect database statistics and get maintenance recommendations. Offline compaction is deprecated.

Database maintenance and inspection. The read-only stats and analyze subcommands work over a data directory; the mutating run and vacuum subcommands are deprecated and exit non-zero.

Offline compaction is removed

compact run and compact vacuum mutate nothing and exit non-zero (code 6). Their tombstone-based algorithm is unsafe against the generated mutation surface: it reclaims nothing from updates and can resurrect deleted rows. Generated databases compact automatically in-process under the single-writer lock, or call Database::compact() from your running app. That path is keep-set-based and never resurrects deletes.

Subcommands#

CommandStatusPurpose
statsactiveShow per-model or database-wide statistics.
analyzeactiveAnalyze the database and print recommendations.
rundeprecatedNo-op; exits non-zero with guidance.
vacuumdeprecatedAlias for run; no-op, exits non-zero.

stats#

forgedb compact stats [--data-dir <DIR>] [--model <NAME>] [--json]
FlagType / defaultMeaning
-d, --data-dir <DIR>string (data)Data directory to inspect.
-m, --model <NAME>stringShow statistics for a single model only.
--jsonbool (false)Emit JSON.

analyze#

forgedb compact analyze [--data-dir <DIR>] [--json]
FlagType / defaultMeaning
-d, --data-dir <DIR>string (data)Data directory to analyze.
--jsonbool (false)Emit JSON.

Examples#

Database-wide statistics as JSON:

forgedb compact stats --data-dir ./data --json

Analyze a single data directory:

forgedb compact analyze --data-dir ./data

The deprecated path exits non-zero:

forgedb compact run
# error: Offline `forgedb compact` / `vacuum` is removed ...
# (exit code 6)

Search documentation

Find pages across the ForgeDB docs