zodbpack

RelStorage also comes with a script named zodbpack that packs any ZODB storage that allows concurrent connections (including RelStorage and ZEO, but not including FileStorage). Use zodbpack in cron scripts. Pass the script the name of a configuration file that lists the storages to pack, in ZConfig format. An example configuration file:

<relstorage>
  pack-gc true
  <mysql>
    db zodb
  </mysql>
</relstorage>

Options for zodbpack

--days or -d
Specifies how many days of historical data to keep. Defaults to 0, meaning no history is kept. This is meaningful even for history-free storages, since unreferenced objects are not removed from the database until the specified number of days have passed.
--prepack
Instructs the storage to only run the pre-pack phase of the pack but not actually delete anything. This is equivalent to specifying pack-prepack-only true in the storage options.
--use-prepack-state
Instructs the storage to only run the deletion (packing) phase, skipping the pre-pack analysis phase. This is equivalent to specifying pack-skip-prepack true in the storage options.
usage: zodbpack [-h] [-d DAYS] [--prepack] [--use-prepack-state] config_file

ZODB storage packing utility.

positional arguments:
  config_file

optional arguments:
  -h, --help            show this help message and exit
  -d DAYS, --days DAYS  Days of history to keep (default 0)
  --prepack             Perform only the pre-pack preparation stage of a pack.
                        (Only works with some storage types)
  --use-prepack-state   Skip the preparation stage and go straight to packing.
                        Requires that a pre-pack has been run, or that packing
                        was aborted before it was completed.