TABLES View

This Information Schema view displays a row for each table and view in the specified (or current) database, including the views in the INFORMATION_SCHEMA schema itself.

See also:

COLUMNS View , VIEWS View

Columns

Column Name

Data Type

Description

TABLE_CATALOG

TEXT

Database that the table belongs to

TABLE_SCHEMA

TEXT

Schema that the table belongs to

TABLE_NAME

TEXT

Name of the table

TABLE_OWNER

TEXT

Name of the role that owns the table

TABLE_TYPE

TEXT

Whether the table is a base table, temporary table, or view

IS_TRANSIENT

TEXT

Whether this is a transient table

CLUSTERING_KEY

TEXT

Clustering key for the table

ROW_COUNT

NUMBER

Number of rows in the table

BYTES

NUMBER

Number of bytes accessed by a scan of the table

RETENTION_TIME

NUMBER

Number of days that historical data is retained for Time Travel

SELF_REFERENCING_COLUMN_NAME

TEXT

Not applicable for Snowflake.

REFERENCE_GENERATION

TEXT

Not applicable for Snowflake.

USER_DEFINED_TYPE_CATALOG

TEXT

Not applicable for Snowflake.

USER_DEFINED_TYPE_SCHEMA

TEXT

Not applicable for Snowflake.

USER_DEFINED_TYPE_NAME

TEXT

Not applicable for Snowflake.

IS_INSERTABLE_INTO

TEXT

Not applicable for Snowflake.

IS_TYPED

TEXT

Not applicable for Snowflake.

COMMIT_ACTION

TEXT

Not applicable for Snowflake.

CREATED

TIMESTAMP_LTZ

Creation time of the table

LAST_ALTERED

TIMESTAMP_LTZ

Date and time when the table was last altered by a DDL or DML operation.

LAST_DDL

TIMESTAMP_LTZ

Timestamp of the last DDL operation performed on the table or view, including database refreshes for replication (if the refresh changes visible properties for the table/view).

LAST_DDL_BY

TEXT

Username of the user who performed the last DDL operation on the table or view.

AUTO_CLUSTERING_ON

BOOLEAN

Whether automatic clustering is enabled for the table

COMMENT

TEXT

Comment for this table

Usage Notes

  • The view only displays objects for which the current role for the session has been granted access privileges. The view does not honor the MANAGE GRANTS privilege and consequently may show less information compared to a SHOW command when both are executed with a role that was granted the MANAGE GRANTS privilege.

    This behavior also applies to other account-level privileges and Information Schema views for which there is a corresponding SHOW command.

  • Querying the sum(bytes) for a table does not represent the total storage usage, because the amount does not include Time Travel and Fail-safe usage.

  • The view does not include tables that have been dropped. To view dropped tables, use SHOW TABLES instead.

  • To view only tables in your queries, filter using a WHERE clause, e.g.:

    ... WHERE table_schema != 'INFORMATION_SCHEMA'

Examples

Retrieve the size (in bytes) of all tables in all schemas in the mydatabase database:

SELECT TABLE_SCHEMA,SUM(BYTES)
    FROM mydatabase.information_schema.tables
    GROUP BY TABLE_SCHEMA;
Copy