Changing the storage type from database to filesystem and running the appropriate migration script moves the data from the database to the filesystem - and frees up the space in the database
Actual behavior:
Attachments are stored on the filesystem, but the toast_bytes data of the store_provider_dbs still contain all attachments data as well!
Steps to reproduce the behavior:
In the past we stored all attachments in our Postgresql database, which grew the toast_bytes of the store_provider_dbs table to over 100 GBs and slowed down everything significantly.
Hence we changed the mechanism to filesystem and executed the migration:
rails> Store::File.move(‘DB’, ‘File’)
After the migration finished successfully, the attachments are written to thhe filesystem AND reside in the database.
Do I have to execute anything else to remove the attachments from the database?
IIRC, this does not have anything to do with Zammad but with PosgtreSQL itself.
I honestly do not know if you can do the following from within Zammad using some Rails routines…
Try to do some vacuuming tasks on the DB - please see this:
I was going to do a FULL VACUUM on the table this weekend, as it might cause stress on the database. But I was greated with a pleasent surprise. The autovacuum mechanism of the database freed up the used space on its own.
So if you can wait a bit PostgreSQL will clean up itself, as long as the appropriate autovacuum configuration is enabled. Otherwise you will have to do a full vacuum manually - which might interfere with ongoing DB requests.