Skip to content

sys.table

A system view that returns information about the user-defined tables in the database.

Note: The yellowbrick database stores a set of yb_* tables that are visible to superusers only. These tables have four-digit table IDs and appear in results when superusers query sys.table and other views that have the sys.table_ prefix.

Column NameData TypeDescription
table_idbigintThe unique ID for the table. Tables in different schemas within the same database may have the same name, so you can use this ID to uniquely identify a table.
database_idbigintThe unique ID for the database.
nametextName of the table.
schema_idbigintUnique ID of the database schema where the table was created.
owner_idbigintUnique ID of the owner of the table, referring to the user who created it.
distributiontextDistribution type: replicated, hash, random.
sort_keytextColumn name if sorted; otherwise null.
distribution_keytextColumn name if distributed by hash; othwerise null.
cluster_keystextColumns used as cluster keys, if any.
partition_keystextColumns used as partitioning columns, if any.
is_tempbooleanWhether the table was created as a temporary table (f=persistent; t=temporary).
definitiontextNot implemented.
is_auto_analyzebooleanf=table not enabled for auto-analyze; t=table enabled for auto-analyze.
auto_analyze_policytextName of the auto-analyze policy enabled for the table, if any (or default_policy).
last_analyzedtimestamptzWhen the table was last analyzed (either manually or automatically).
creation_timetimestamptzWhen the table was created.
rowstore_bytesbigintNumber of bytes committed to the row store for the table.
rowstore_row_countbigintNumber of rows committed to the row store for the table.
rowstore_disk_usagebigintTotal size of files currently used in the row store for the table. An entire file (32MB) is reported as in use even if there is only a single row in the table. In general, partially filled files are filled up before new ones are created.
rowstore_size_limitbigintTotal size allowed in the row store for the table. The default is 500GB. See also ALTER TABLE.
rowstore_full_action"char"Action taken when the row store size limit is reached for the table: S (Slow), B (Block), or C (Cancel). See Managing the Row Store and ALTER TABLE.

Examples

premdb=# select table_id, name, distribution, distribution_key, last_analyzed 
from sys.table order by table_id;
 table_id |     name      | distribution | distribution_key |         last_analyzed         
----------+---------------+--------------+------------------+-------------------------------
   16882 | season        | replicated   |                  | 2017-09-01 11:47:50.685147-07
   16885 | team          | replicated   |                  | 2017-09-01 11:47:56.03602-07
   16888 | hometeam      | replicated   |                  | 2017-09-01 11:44:19.424487-07
   16891 | awayteam      | replicated   |                  | 2017-09-01 11:44:19.032821-07
   16894 | match         | hash         | seasonid         | 2017-09-01 11:48:07.712739-07
   16898 | newmatchstats | hash         | seasonid         | 2017-09-01 11:40:18.967244-07
(6 rows)
premdb_match=# select name, rowstore_bytes, rowstore_row_count, rowstore_disk_usage, rowstore_size_limit, rowstore_full_action from sys.table where table_id>10000;
 name  | rowstore_bytes | rowstore_row_count | rowstore_disk_usage | rowstore_size_limit | rowstore_full_action 
-------+----------------+--------------------+---------------------+---------------------+----------------------
 new   |            231 |                  3 |            33554432 |        549755813888 | S
 match |       33288310 |               6502 |            33554432 |            33554432 | S
(2 rows)

Parent topic:System Views