Schema:

ACCOUNT_USAGE

TABLES View

This Account Usage view displays a row for each table and view in the account.

See also:

COLUMNS View , VIEWS View

Columns

Column Name

Data Type

Description

TABLE_ID

NUMBER

Internal, Snowflake-generated identifier for the table.

TABLE_NAME

TEXT

Name of the table.

TABLE_SCHEMA_ID

NUMBER

Internal, Snowflake-generated identifier of the schema for the table.

TABLE_SCHEMA

TEXT

Schema that the table belongs to.

TABLE_CATALOG_ID

NUMBER

Internal, Snowflake-generated identifier of the database for the table.

TABLE_CATALOG

TEXT

Database that the table belongs to.

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 the table is transient.

CLUSTERING_KEY

TEXT

Column(s) and/or expression(s) that comprise the 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

Date and time when the table was created.

LAST_ALTERED

TIMESTAMP_LTZ

Date and time when the table was last altered.

DELETED

TIMESTAMP_LTZ

Date and time when the table was dropped.

COMMENT

TEXT

Comment for the table.

Usage Notes

  • Latency for the view may be up to 90 minutes.

  • The view only displays objects for which the current role for the session has been granted access privileges.

  • The view does not recognize the MANAGE GRANTS privilege and consequently may show less information compared to a SHOW command executed by a user who holds the MANAGE GRANTS privilege.

  • 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.

Examples

Retrieve the total size (in bytes) of all active tables in all schemas in your account:

SELECT TABLE_SCHEMA,SUM(BYTES)
    FROM snowflake.account_usage.tables
    WHERE DELETED IS NULL
    GROUP BY TABLE_SCHEMA;