How to find the PGSQL database table size in Airwave

By esupport posted Dec 19, 2016 01:07 PM


How to find the database table size in Airwave for a specific table?


We could execute the command below in the Airwave CLI to find the size of a specific table:

# dbc "select pg_size_pretty(pg_total_relation_size('ap'));

The above command will show the size of the ap table, as shown in the example output below:

[root@localhost mercury]# dbc "select pg_size_pretty(pg_total_relation_size('ap'));"
 272 kB
(1 row)

However, if we want to see the size of all the tables individually, we could run the below command:

# dbsize

This command will list out the table name's and their size's, individually.

Note: The list will be big, might not be easy to read in the single window, we could use the flags like "# dbsize | more" or  "# dbsize | less" to see the list in pages or we could also pipe the output to a text file, by running the command # dbsize > /tmp/<anyfilename.txt>