Overview
The pg_total_relation_size() is a database object size function that retrieves the size of a table and is useful for monitoring the storage requirements.Syntax
The syntax for thepg_total_relation_size()
function is as follows:
Parameters
The following parameters are required to execute this function:relation_name
: name of the table for which you want to determine the size
Example
For the needs of this section, we will create a users tablepg_total_relation_size()
function to determine the size of the users table (in bytes)