More on PostgreSQL

(We marked visited pages blue)
  • How to Optimize PostgreSQL Performance with VACUUM, ANALYZE, and REINDEX
  • Step by Step PostgreSQL installation on Linux
  • Postgresql Where Clause
  • Postgresql View
  • Postgresql Vacuum Statement
  • Postgresql Upper Function
  • Postgresql Update Statement
  • Postgresql Unique Constraints
  • Postgresql Union Operator
  • Postgresql Union All Operator
  • Postgresql Truncate Table Statement
  • Postgresql Trunc Function
  • Postgresql Trim Function
  • Postgresql Translate Function
  • Postgresql To_number Function
  • Postgresql To_date Function
  • Postgresql To_char Function
  • Postgresql Sum Function
  • Postgresql Substring Function
  • Postgresql Subqueries
  • Postgresql Strpos Function
  • Postgresql Sqrt Function
  • Postgresql Sign Function
  • Postgresql Setseed Function
  • Postgresql Select Statement
  • Postgresql Select Limit Statement
  • Postgresql Rtrim Function
  • Postgresql Rpad Function
  • Postgresql Round Function
  • Postgresql Replace Function
  • Postgresql Repeat Function
  • Postgresql Rename A User
  • Postgresql Random Function
  • Postgresql Primary Keys
  • Postgresql Power Function
  • Postgresql Position Function
  • Postgresql Order By Clause
  • Postgresql Or Condition
  • Postgresql Now Function
  • Postgresql Not Condition
  • Postgresql Mod Function
  • Postgresql Min Function
  • Postgresql Max Function
  • Postgresql Ltrim Function
  • Postgresql Lpad Function
  • Postgresql Lower Function
  • Postgresql Localtimestamp Function
  • Postgresql Localtime Function
  • Postgresql Literals
  • Postgresql Like Condition
  • Postgresql Length Function
  • Postgresql Joins
  • Postgresql Is Null Condition
  • Postgresql Is Not Null
  • Postgresql Intersect Operator
  • Postgresql Insert Statement
  • Postgresql Initcap Function
  • Postgresql Indexes
  • Postgresql In Condition
  • Postgresql Having Clause
  • Postgresql Group By Clause
  • Postgresql Grant Revoke Privileges
  • Postgresql From Clause
  • Postgresql Floor Function
  • Postgresql Find Users In Postgresql
  • Postgresql Extract Function
  • Postgresql Exp Function
  • Postgresql Exists Condition
  • Postgresql Except Operator
  • Postgresql Drop User Statement
  • Postgresql Drop Table Statement
  • Postgresql Div Function
  • Postgresql Distinct Clause
  • Postgresql Delete Statement
  • Postgresql Declaring Variables
  • Postgresql Date_part Function
  • Postgresql Data Types
  • Postgresql Current_timestamp Function
  • Postgresql Current_time Function
  • Postgresql Current_date Function
  • Postgresql Create User Statement
  • Postgresql Create Table Statement
  • Postgresql Create Table As Statement
  • Postgresql Count Function
  • Postgresql Comparison Operators
  • Postgresql Comments Within Sql
  • Postgresql Combining The And And Or Conditions
  • Postgresql Character_length Function
  • Postgresql Char_length Function
  • Postgresql Change A User Password
  • Postgresql Ceiling Function
  • Postgresql Ceil Function
  • Postgresql Btrim Function
  • Postgresql Between Condition
  • Postgresql Avg Function
  • Postgresql Autovacuum Daemon
  • Postgresql And Condition
  • Postgresql Alter Table Statement
  • Postgresql Aliases
  • Postgresql Age Function
  • Postgresql Abs Function
  • How to find the size of PostgreSQL databases and tables

    This article demonstrates how to determine the size of PostgreSQL databases and tables. You can do this by using the psql command-line program (for databases and tables).

    USING THE COMMAND LINE

    You can use the psql command-line program to determine the sizes of PostgreSQL databases and tables. To do this, follow these steps:
    1. Log in to your account using SSH.
    2. At the command line, type the following command. Replace dbname with the name of the database, and username with the database username:
      psql dbname username
    3. At the Password prompt, type the database user's password. When you type the correct password, the psql prompt appears.
    4. To determine the size of a database, type the following command. Replace dbnamewith the name of the database that you want to check:
      SELECT pg_size_pretty( pg_database_size('dbname') );
      Psql displays the size of the database.
    5. To determine the size of a table in the current database, type the following command. Replace tablename with the name of the table that you want to check:
      SELECT pg_size_pretty( pg_total_relation_size('tablename') );
      Psql displays the size of the table.


    Leave a comment or a question in the comment area bellow if you fell like


    Be a sport and

    Search

    Loading... Please wait

    Subscribe to our Newsletter

    Be a sport and

    x