View pg_table_matview_infos

Creates a view with information about the size of the table/materialized view and sizes of indexes on that table/materialized view. It does also list all indexes on that table in an array.

List of supported object types

object type <=10 >=11
PARTITIONED INDEX   X
SEQUENCE X X
COMPOSITE TYPE X X
FOREIGN TABLE X X
INDEX X X
MATERIALIZED VIEW X X
PARTITIONED TABLE X X
TABLE X X
VIEW X X
DATABASE X X
EXTENSION X X
FOREIGN DATA WRAPPER X X
FOREIGN SERVER X X
LANGUAGE X X
SCHEMA X X
OPERATOR CLASS   X
PROCEDURE   X
AGGREGATE FUNCTION   X
WINDOW FUNCTION   X
COLLATION X X
CONVERSION X X
EVENT TRIGGER X X
OPERATION FAMILY X X
PUBLICATIONS X X

Columns

Column Name datatype Description
object_owner name The role which is owning the obejct.
tablespace name The table space where the object is stored.
indexes ARRAY All indexes that have been created on this object.
object_size bigint The size of the data of this object.
indexes_size bigint The size of the indexes of this object.
total_object_size bigint The overall size of this object.
total_object_size_pretty text The size of the data of this object with unit.
indexes_size_pretty text The size of the indexes of this object with unit.
total_relation_size_pretty text The overall size of this object with the unit.

Example

SELECT *
FROM pg_table_matview_infos;

Result:

type schema_name tablename tableowner tablespace indexes table_size indexes_size total_relation_size table_size_pretty indexes_size_pretty total_relation_size_pretty
table public MediaType stefanie [NULL] {PK_MediaType} 8192 16384 24576 8192 bytes 16 kB 24 kB
table public Playlist stefanie [NULL] {PK_Playlist} 8192 16384 24576 8192 bytes 16 kB 24 kB