Find the size of postgresql database

Postgresql -- Posted on July 7, 2023

The SQL query you provided is used to calculate and display the size of a PostgreSQL database named 'database_name' in a human-readable format. The function pg_database_size() returns the size of the specified database in bytes, and pg_size_pretty() is a function used to convert the size in bytes to a more readable format with units like KB, MB, GB, etc.

 

              
                SELECT pg_size_pretty( pg_database_size('database_name') );
                  
   
            

Related Posts