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#
| Command | Status | Purpose |
|---|---|---|
stats | active | Show per-model or database-wide statistics. |
analyze | active | Analyze the database and print recommendations. |
run | deprecated | No-op; exits non-zero with guidance. |
vacuum | deprecated | Alias for run; no-op, exits non-zero. |
stats#
forgedb compact stats [--data-dir <DIR>] [--model <NAME>] [--json]| Flag | Type / default | Meaning |
|---|---|---|
-d, --data-dir <DIR> | string (data) | Data directory to inspect. |
-m, --model <NAME> | string | Show statistics for a single model only. |
--json | bool (false) | Emit JSON. |
analyze#
forgedb compact analyze [--data-dir <DIR>] [--json]| Flag | Type / default | Meaning |
|---|---|---|
-d, --data-dir <DIR> | string (data) | Data directory to analyze. |
--json | bool (false) | Emit JSON. |
Examples#
Database-wide statistics as JSON:
forgedb compact stats --data-dir ./data --jsonAnalyze a single data directory:
forgedb compact analyze --data-dir ./dataThe deprecated path exits non-zero:
forgedb compact run
# error: Offline `forgedb compact` / `vacuum` is removed ...
# (exit code 6)