Pack relstorage

Which exact steps are necessary to actually shrink a Plone database that uses relstorage (postgres)?

https://relstorage.readthedocs.io/en/latest/zodbpack.html

1 Like

What I don't get is how to avoid actually blowing up the database, as described here: Packing A Database May Increase Disk Usage

When I use this configuration file with multi-zodb-gc as suggested

<zodb main>
    <relstorage>
        pack-gc true
        <postgresql>
            dsn host='db' dbname='plone' user='plone' password='ploneverysecret'
        </postgresql>
    </relstorage>
</zodb>

I get a Syntax Error for the config file ZConfig.SchemaError: unknown type name: 'relstorage' - can this even handle relstorage?

If this is the configuration of the relstorage zodbpack, you probably need to remove <zodb main> and </zodb>.

Thanks for the help!

I removed the enclosing "zodb" tag, but I get a similar error:

ZConfig.ConfigurationSyntaxError: unknown type name: 'relstorage'
(line 1 in file:///app/zodbpack_config_file)

Could anyone post a working configuration for a configuration file for a default Plone setup with relstorage?

Precondition: Python (venev) with RelStorage installed: pip install RelStorage[postgresql]

<relstorage>
    keep-history false # or true, depends on your relstorage configuration
    blob-dir = var/blobstorage # skip, if blobs are stored in the database
    <postgresql>
        dsn dbname='DBNAME' host='DBHOST' user='DBUSER' password='DBPASSWORD'
    </postgresql>
</relstorage>

for more see Packing Or Reference Checking A ZODB Storage: zodbpack - RelStorage 4.0.0a2.dev0 documentation
Also read why a database might increase in size after packing: Tips and Other Useful Information - RelStorage 4.0.0a2.dev0 documentation