Postgres DB Size Command

后端 未结 10 586
孤独总比滥情好
孤独总比滥情好 2021-01-29 17:09

What is the command to find the size of all the databases?

I am able to find the size of a specific database by using following command:

         


        
10条回答
  •  故里飘歌
    2021-01-29 17:51

    Based on the answer here by @Hendy Irawan

    Show database sizes:

    \l+

    e.g.

    => \l+
     berbatik_prd_commerce    | berbatik_prd     | UTF8     | en_US.UTF-8 | en_US.UTF-8 |                       | 19 MB   | pg_default | 
     berbatik_stg_commerce    | berbatik_stg     | UTF8     | en_US.UTF-8 | en_US.UTF-8 |                       | 8633 kB | pg_default | 
     bursasajadah_prd         | bursasajadah_prd | UTF8     | en_US.UTF-8 | en_US.UTF-8 |                       | 1122 MB | pg_default | 
    

    Show table sizes:

    \d+

    e.g.

    => \d+
     public | tuneeca_prd | table | tomcat | 8192 bytes | 
     public | tuneeca_stg | table | tomcat | 1464 kB    | 
    

    Only works in psql.

提交回复
热议问题