Quick post here to show how to display the size of the tables in a PostgreSQL database.
The SQL code [1]
select
table_name,
pg_size_pretty(pg_total_relation_size(quote_ident(table_name))),
pg_relation_size(quote_ident(table_name))
from information_schema.tables
where table_schema = 'public'
order by 3 desc;
This code is very interesting to see which table is taking too much space in you PostgreSQL db, this allow effective data cleanup. It is better to know which table take some space before working on optimizing.
the following commands can also be helpful to retrieve free space as PostgreSQL stores information for backup, replication, or rollback which have to be cleaned regularly.
vaccum full;
be advise that this will block the database (and therefore Odoo) so you need to plan some maintenance time to perfom this operation.