We have an onpremise infrastructure and we are a little bit worried about the size of the PostgreSQL database that retools use for its internall processes. Why is so big? Is there any way to optimize the space?
postgres=# SELECT
pg_database.datname AS database,
pg_size_pretty(pg_database_size(pg_database.datname)) AS size
Most likely the top 2 tables eat most of the spaces:
page_saves & audit_trail_events
I believe currently Retool self-host neither have data retention policy nor have a handy tool to backup the old data….so those tables will just grow bigger and bigger overtime. Especially, if i understand correctly, page_saves saves the full code of the app on every change / release, so it will consume disk space aggresively.
The the audit_trail_events table is safe to trim as needed.
As Linda mentioned in the thread that Zelter linked, she is correct.
The page_save holds all of every single time an app saves and can grow really big really fast.
If you clear it out, you will not be able to go back in a previous save.
Thus, the best option for trimming is to make a new release version of your app. Then when you join with the tags table, you can benchmark all the changes based on which tag(app version) the change corresponds to.
Then you can pick how far back in terms of app version you are ok with parting ways from and can then do the DB surgery to delete the save rows that are prior to the app version you want to keep!
Be careful with DB surgery as we recommend having a backup just in case anything unexpected happens so you can avoid the worse case scenario of losing a save or version of you app that you want to keep.