How much disk space does a table use?
The maximum supported table size in the default configuration is 32 TB, and it does not require large file support from the operating system. The filesystem size limits do not impact the large tables, as they are stored in multiple 1 GB files.
Large tables can suffer performance issues. Indexes can take much longer to update, and query performance can degrade. In this recipe, we will see how to measure the size of a table.
How to do it…
We can see the size of a table by using this command:
cookbook=# select pg_relation_size('pgbench_accounts');
The output of this command is as follows:
pg_relation_size
------------------
13434880
(1 row)
We can also see the total size of a table, including indexes and other related spaces, as follows:
cookbook=# select pg_total_relation_size('pgbench_accounts');
The output is as follows:
pg_total_relation_size
---------------------...