Postgre DB is big (20+GB) - How can I understand what's stored there?
-
Postgresql contain 21 GB of data on my Cloudron server that only has a single app: Baserow
The baserow database itself only contains around a hundred records, nothing huge.
So, I wonder why the postgresql on that server is so huge. Can I login to it and navigate the PG DB directly? Or is there another simpler/smarter way to understand what's being stored there?$ du -h --max-depth=1 21G ./postgresql 84K ./addons 197M ./mysql 20K ./oidc 518M ./mongodb 136K ./nginx 4.0K ./tls 16K ./logrotate.d 4.0K ./cifs 12K ./backup 4.0K ./acme 4.0K ./sshfs 236K ./update 8.0K ./diskusage 24K ./sftp 524K ./redis 207M ./logs 4.0K ./firewall 12K ./collectd 48M ./graphite 22G .
-
I guess some app is storing a lot in postgres. With some help from ChatGPT:
docker exec -it postgresql /bin/bash psql -Uroot --dbname=postgres
Then, run this query in postgresql prompt:
SELECT pg_database.datname AS database_name, pg_size_pretty(pg_database_size(pg_database.datname)) AS size FROM pg_database ORDER BY pg_database_size(pg_database.datname) DESC;
This gives a bunch of daabase names like
dbf88f51a1c41249a6947427dedb491dfd
. Take the first 6 characters likef88f51a1
and put in the search field in the dashboard. This will reveal the app. -
-
@AmbroiseUnly I don’t use baserow but I’ve ran into something similar with other apps and it was the log files. Check the upstream docs and in-app to locate them. Report this upstream too.
-
Reading fail on my part, sorry. @AmbroiseUnly so the next step is to determine which table in baserow is taking much space. Could be logs as @humptydumpty mentioned. You can access the db from Web Terminal and click the postgres button on nav bar