pg_statio_user_tables
The pg_statio_user_tables contains one row for each user table in the current database, showing statistics columns filled with zeros.
Columns
The following columns are available for querying in pg_statio_user_tables :
| Column | Type | Description |
|---|---|---|
|
|
This column represents the table ID |
|
|
This column represents the table name |
|
|
This column represents the schema name that this table is in |
|
|
unused |
|
|
unused |
|
|
unused |
|
|
unused |
|
|
unused |
|
|
unused |
|
|
unused |
|
|
unused |
Examples
-
Create a new table:
CREATE TABLE example_table ( data text, cluster text, storage int ); -
Run the query combined with a
WHEREclause to look up based on the table name (relname):SELECT relid, schemaname, relname FROM pg_statio_user_tables; -
This returns the table size in bytes:
relid | schemaname | relname -------+------------+--------------- 16384 | public | job 16385 | public | example_table (2 rows)