Clear database cache?
Is there a way to clear the database cache. My database grew to 12GB, i've deleted a lot of the data in the database, but the database size has not reduced.
Im assuming theres a cache or something I need to clear?
1 Reply
Postgres doesn’t auto-shrink when you delete rows — the space is just marked for reuse.
If you really want to free up disk space, run:
VACUUM FULL;
Note: VACUUM FULL locks tables while it runs, so do it during low traffic.
You can also check which tables are taking up space:
SELECT relname, pg_size_pretty(pg_total_relation_size(relid))
FROM pg_catalog.pg_statio_user_tables
ORDER BY pg_total_relation_size(relid) DESC;
@Evostance I hope your problem is resolved.