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.

compressed_bytesbigintTotal compressed bytes of actual, live usage on all transactions on the workers.
uncompressed_bytesbigintTotal uncompressed bytes of actual, live usage on all transactions on the workers. This does not include bytes in the rowstore on the manager nodes.
snapshot_backup_bytesbigintBackup and restore system data, which is stored in internal system tables. Managed by the backups and only decreases when full backups occur. This data is not counted in the quota decision for the current transaction but is counted for subsequent transactions.
delete_info_bytesbigintDeleted and updated system data on the workers, which is kept in specialized internal data blocks.
reclaimable_bytesbigintDeleted or updated user data on the workers that will be freed up in the background.
max_size_bytesbigintMaximum size of the table set by the quota. NULL if no disk usage limit is set.

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)

Return information for a table named season:

premdb=# select * from sys.database where name = 'premdb'; 
-[ RECORD 1 ]---------+---------
table_id              | 16635
database_id           | 16634
name                  | season
schema_id             | 2200
owner_id              | 16007
distribution          | replicated
sort_key              | [NULL]
distribution_key      | [NULL]
cluster_keys          | [NULL]
partition_keys        | [NULL]
is_temp               | f
definition            | [NULL]
is_auto_analyze       | t
auto_analyze_policy   | default_policy
last_analyzed         | [NULL]
creation_time         | 2020-10-01 15:01:01.747977-07
rowstore_bytes        | 1917
rowstore_row_count    | 25
rowstore_disk_usage   | 33554432
rowstore_size_limit   | 549755813888
rowstore_full_action  | S
compressed_bytes      | 0
uncompressed_bytes    | 0
snapshot_backup_bytes | 0
delete_info_bytes     | 0
reclaimable_bytes     | 0
max_size_bytes        | [NULL]

Parent topic:System Views