Database object size functions calculate the actual disk space used by database objects.
Description: Specifies the number of bytes used to store a particular value (possibly compressed).
Return type: integer
Note: pg_column_size displays the space for storing an independent data value.
1 2 3 4 5 | SELECT pg_column_size(1); pg_column_size ---------------- 4 (1 row) |
Description: Specifies the disk space used by the database with the specified OID.
Return type: bigint
Description: Specifies the disk space used by the database with the specified name.
Return type: bigint
Note: pg_database_size receives the OID or name of a database and returns the disk space used by the corresponding object.
Example:
1 2 3 4 5 | SELECT pg_database_size('gaussdb'); pg_database_size ------------------ 51590112 (1 row) |
Description: Specifies the disk space used by the table with a specified OID or index.
Return type: bigint
Description: Estimates the total size of non-compressed data in the current database.
Return type: bigint
Note: (1) ANALYZE must be performed before this function is called. (2) Calculate the total size of non-compressed data by estimating the compression rate of column-store tables.
Example:
1 2 3 4 5 6 7 | analyze; ANALYZE SELECT get_db_source_datasize(); get_db_source_datasize ------------------------ 35384925667 (1 row) |
Description: Specifies the disk space used by the table with a specified name or index. The table name can be schema-qualified.
Return type: bigint
Description: Specifies the disk space used by the specified bifurcating tree ('main', 'fsm', or 'vm') of a certain table or index.
Return type: bigint
Description: Is an abbreviation of pg_relation_size(..., 'main').
Return type: bigint
Note: pg_relation_size receives the OID or name of a table, index, or compressed table, and returns the size.
Description: Specifies the disk space used by the partition with a specified OID. The first oid is the OID of the table and the second oid is the OID of the partition.
Return type: bigint
Description: Specifies the disk space used by the partition with a specified name. The first text is the table name and the second text is the partition name.
Return type: bigint
Description: Specifies the disk space used by the index of the partition with a specified OID. The first oid is the OID of the table and the second oid is the OID of the partition.
Return type: bigint
Description: Specifies the disk space used by the index of the partition with a specified name. The first text is the table name and the second text is the partition name.
Return type: bigint
Description: Specifies the total disk space used by the index appended to the specified table.
Return type: bigint
Description: Converts the calculated byte size into a size readable to human beings.
Return type: text
Description: Converts the calculated byte size indicated by a numeral into a size readable to human beings.
Return type: text
Note: pg_size_pretty formats the results of other functions into a human-readable format. KB/MB/GB/TB can be used.
Description: Specifies the disk space used by the specified table, excluding indexes (but including TOAST, free space mapping, and visibility mapping).
Return type: bigint
Description: Specifies the disk space used by the table with a specified OID, including the index and the compressed data.
Return type: bigint
Description: Specifies the total disk space used by the specified table, including all indexes and TOAST data.
Return type: bigint
Description: Specifies the disk space used by the table with a specified name, including the index and the compressed data. The table name can be schema-qualified.
Return type: bigint
Note: pg_total_relation_size receives the OID or name of a table or a compressed table, and returns the sizes of the data, related indexes, and the compressed table in bytes.