# database operations

- `POST /db/train`: train zstd compression dictionaries for trainable keyspaces such as `repos` and `events` (plus feature-gated event/index keyspaces). the crawler, firehose, and backfill worker are paused for the duration and restored on completion. dictionaries are written to disk as `dict_<name>.bin` in the database folder, but a restart doesn't apply them to an existing database. a keyspace's compression is saved when the keyspace is created and reused on every later open, so a dictionary only gets used by a keyspace created while its file is already in the database folder (see [fixed when the database is created](https://hydrant.klbr.net/configuration/index.md#fixed-when-the-database-is-created)).
- `POST /db/compact`: trigger a full major compaction of all database keyspaces in parallel. the crawler, firehose, and backfill worker are paused for the duration and restored on completion.
