Hi,
The following queries can help you to have insights upon the database storage usage:
run below query to know each database size
SELECT pg_database.datname as "database_name", pg_database_size(pg_database.datname)/1024/1024 AS size_in_mb FROM pg_database where datname not like ('%azure%') ORDER by size_in_mb DESC;
You can get each database temporary files and size using view pg_stat_database
SELECT * FROM pg_stat_database;
At times, replication slots can significantly affect server availability and storage usage. Replication slots retain Postgres WAL logs and relevant system catalogs until they are read by a consumer. If this process fails, unprocessed logs can accumulate and occupy server storage.
You can check replication slots on server by running:
select * from pg_replication_slots;
Analyze the subsequent server parameters that could potentially contribute to the increase in storage usage.
It's worth noting that you have the option to adjust the retention period for this short-term log storage by using the log_retention_period parameter. The default value is 3 days, and the maximum value allowed is 7 days.
The common recommendation is to exercise caution when using verbose logging. More information can be found in my colleague blog How to configure Postgres log settings - Microsoft Tech Community
I hope this is helpful.
Thank you!