0

I am looking for a way to list PostgreSQL Database Data and Log sizes.

Using the following command we can check the total database size based on the documentation https://pgpedia.info/p/pg_database_size.html

pg_database_size('database_name')

I am not really sure if this function displays data and logs summarized together. Is there any way to get these numbers separately, so we can know how much is the data files and how much is the log files?

9
  • What kind of "logs" are you referring to? The Postgres error log is most certainly not included in that figure as it is used for all databases (and processes) in the instance
    – user1822
    Commented Nov 25, 2022 at 8:14
  • Do you want to monitor equivalent of transacion log? You should monitor WAL files.
    – user_0
    Commented Nov 25, 2022 at 8:44
  • For example, if your instance is full but the databases sizes is only 10% of the instance capacity, it should be the log files -> WAL files. Coming from SQL Server, I thought that each database has each own log file. Commented Nov 25, 2022 at 8:47
  • No, Postgres is more like Oracle in this regard. The WAL segments are managed for the whole instance. postgresql.org/docs/current/wal-intro.html
    – user1822
    Commented Nov 25, 2022 at 8:57
  • So any ideas how I can check WAL files size in Azure for Postgres for example? Commented Nov 25, 2022 at 9:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.