Skip to main content
Version: Stable-3.1

Information Schema

The StarRocks information_schema is a database within each StarRocks instance. information_schema contains several read-only, system-defined tables which store extensive metadata information of all objects that the StarRocks instance maintains.

View metadata via Information Schema

You can view the metadata information within a StarRocks instance by querying the content of tables in information_schema.

The following example views metadata information about a table named sr_member in StarRocks by querying the table tables.

mysql> SELECT * FROM information_schema.tables WHERE TABLE_NAME like 'sr_member'\G
*************************** 1. row ***************************
TABLE_CATALOG: def
TABLE_SCHEMA: sr_hub
TABLE_NAME: sr_member
TABLE_TYPE: BASE TABLE
ENGINE: StarRocks
VERSION: NULL
ROW_FORMAT: NULL
TABLE_ROWS: 6
AVG_ROW_LENGTH: 542
DATA_LENGTH: 3255
MAX_DATA_LENGTH: NULL
INDEX_LENGTH: NULL
DATA_FREE: NULL
AUTO_INCREMENT: NULL
CREATE_TIME: 2022-11-17 14:32:30
UPDATE_TIME: 2022-11-17 14:32:55
CHECK_TIME: NULL
TABLE_COLLATION: utf8_general_ci
CHECKSUM: NULL
CREATE_OPTIONS: NULL
TABLE_COMMENT: OLAP
1 row in set (1.04 sec)

Information Schema tables

StarRocks has optimized the metadata information provided by the tables tables, tables_config, and load_tracking_logs and has provided the loads table from v3.1 onwards in information_schema:

Information Schema table nameDescription
tablesProvides general metadata information of tables.
tables_configProvides additional table metadata information that is unique to StarRocks.
load_tracking_logsProvides error information (if any) of load jobs.
loadsProvides the results of load jobs. This table is supported from v3.1 onwards. Currently, you can only view the results of Broker Load and Insert jobs from this table.

loads

The following fields are provided in loads:

FieldDescription
JOB_IDThe unique ID assigned by StarRocks to identify the load job.
LABELThe label of the load job.
DATABASE_NAMEThe name of the database to which the destination StarRocks tables belong.
STATEThe state of the load job. Valid values:
  • PENDING: The load job is created.
  • QUEUEING: The load job is in the queue waiting to be scheduled.
  • LOADING: The load job is running.
  • PREPARED: The transaction has been committed.
  • FINISHED: The load job succeeded.
  • CANCELLED: The load job failed.
For more information, see Asynchronous loading.
PROGRESSThe progress of the ETL stage and LOADING stage of the load job.
TYPEThe type of the load job. For Broker Load, the return value is BROKER. For INSERT, the return value is INSERT.
PRIORITYThe priority of the load job. Valid values: HIGHEST, HIGH, NORMAL, LOW, and LOWEST.
SCAN_ROWSThe number of data rows that are scanned.
FILTERED_ROWSThe number of data rows that are filtered out due to inadequate data quality.
UNSELECTED_ROWSThe number of data rows that are filtered out due to the conditions specified in the WHERE clause.
SINK_ROWSThe number of data rows that are loaded.
ETL_INFOThe ETL details of the load job. A non-empty value is returned only for Spark Load. For any other types of load jobs, an empty value is returned.
TASK_INFOThe task execution details of the load job, such as the timeout and max_filter_ratio settings.
CREATE_TIMEThe time at which the load job was created. Format: yyyy-MM-dd HH:mm:ss. Example: 2023-07-24 14:58:58.
ETL_START_TIMEThe start time of the ETL stage of the load job. Format: yyyy-MM-dd HH:mm:ss. Example: 2023-07-24 14:58:58.
ETL_FINISH_TIMEThe end time of the ETL stage of the load job. Format: yyyy-MM-dd HH:mm:ss. Example: 2023-07-24 14:58:58.
LOAD_START_TIMEThe start time of the LOADING stage of the load job. Format: yyyy-MM-dd HH:mm:ss. Example: 2023-07-24 14:58:58.
LOAD_FINISH_TIMEThe end time of the LOADING stage of the load job. Format: yyyy-MM-dd HH:mm:ss. Example: 2023-07-24 14:58:58.
JOB_DETAILSThe details about the data loaded, such as the number of bytes and the number of files.
ERROR_MSGThe error message of the load job. If the load job did not encounter any error, NULL is returned.
TRACKING_URLThe URL from which you can access the unqualified data row samples detected in the load job. You can use the curl or wget command to access the URL and obtain the unqualified data row samples. If no unqualified data is detected, NULL is returned.
TRACKING_SQLThe SQL statement that can be used to query the tracking log of the load job. A SQL statement is returned only when the load job involves unqualified data rows. If the load job does not involve any unqualified data rows, NULL is returned.
REJECTED_RECORD_PATHThe path from which you can access all the unqualified data rows that are filtered out in the load job. The number of unqualified data rows logged is determined by the log_rejected_record_num parameter configured in the load job. You can use the wget command to access the path. If the load job does not involve any unqualified data rows, NULL is returned.

tables

The following fields are provided in tables:

FieldDescription
TABLE_CATALOGName of the catalog that stores the table.
TABLE_SCHEMAName of the database that stores the table.
TABLE_NAMEName of the table.
TABLE_TYPEType of the table. Valid values: "BASE TABLE" or "VIEW".
ENGINEEngine type of the table. Valid values: "StarRocks", "MySQL", "MEMORY" or an empty string.
VERSIONApplies to a feature not available in StarRocks.
ROW_FORMATApplies to a feature not available in StarRocks.
TABLE_ROWSRow count of the table.
AVG_ROW_LENGTHAverage row length (size) of the table. It is equivalent to DATA_LENGTH / TABLE_ROWS. Unit: Byte.
DATA_LENGTHData length (size) of the table. Unit: Byte.
MAX_DATA_LENGTHApplies to a feature not available in StarRocks.
INDEX_LENGTHApplies to a feature not available in StarRocks.
DATA_FREEApplies to a feature not available in StarRocks.
AUTO_INCREMENTApplies to a feature not available in StarRocks.
CREATE_TIMEThe time when the table is created.
UPDATE_TIMEThe last time when the table is updated.
CHECK_TIMEThe last time when a consistency check is performed on the table.
TABLE_COLLATIONThe default collation of the table.
CHECKSUMApplies to a feature not available in StarRocks.
CREATE_OPTIONSApplies to a feature not available in StarRocks.
TABLE_COMMENTComment on the table.

tables_config

The following fields are provided in tables_config:

FieldDescription
TABLE_SCHEMAName of the database that stores the table.
TABLE_NAMEName of the table.
TABLE_ENGINEEngine type of the table.
TABLE_MODELTable type. Valid values: "DUP_KEYS", "AGG_KEYS", "UNQ_KEYS" or "PRI_KEYS".
PRIMARY_KEYThe primary key of a Primary Key table or a Unique Key table. An empty string is returned if the table is not a Primary Key table or a Unique Key table.
PARTITION_KEYThe partitioning columns of the table.
DISTRIBUTE_KEYThe bucketing columns of the table.
DISTRIBUTE_TYPEThe data distribution method of the table.
DISTRIBUTE_BUCKETNumber of buckets in the table.
SORT_KEYSort keys of the table.
PROPERTIESProperties of the table.
TABLE_IDID of the table.

load_tracking_logs

This feature is supported since StarRocks v3.0.

The following fields are provided in load_tracking_logs:

FieldDescription
JOB_IDThe ID of the load job.
LABELThe label of the load job.
DATABASE_NAMEThe database that the load job belongs to.
TRACKING_LOGError logs (if any) of the load job.
TypeThe type of the load job. Valid values: BROKER, INSERT, ROUTINE_LOAD and STREAM_LOAD.

materialized_views

The following fields are provided in materialized_views:

FieldDescription
MATERIALIZED_VIEW_IDID of the materialized view
TABLE_SCHEMADatabase in which the materialized view resides
TABLE_NAMEName of the materialized view
REFRESH_TYPERefresh type of the materialized view. Valid values: ROLLUP (synchronous materialized view), ASYNC (asynchronous refresh materialized view), and MANUAL (manual refresh materialized view). When the value is ROLLUP, all fields related to activation status and refresh are empry.
IS_ACTIVEIndicates whether the materialized view is active. Inactive materialized views can not be refreshed or queried.
INACTIVE_REASONThe reason that the materialized view is inactive
PARTITION_TYPEType of partitioning strategy for the materialized view
TASK_IDID of the task responsible for refreshing the materialized view
TASK_NAMEName of the task responsible for refreshing the materialized view
LAST_REFRESH_START_TIMEStart time of the most recent refresh task
LAST_REFRESH_FINISHED_TIMEEnd time of the most recent refresh task
LAST_REFRESH_DURATIONDuration of the most recent refresh task
LAST_REFRESH_STATEState of the most recent refresh task
LAST_REFRESH_FORCE_REFRESHIndicates whether the most recent refresh task was a force refresh
LAST_REFRESH_START_PARTITIONStarting partition for the most recent refresh task
LAST_REFRESH_END_PARTITIONEnding partition for the most recent refresh task
LAST_REFRESH_BASE_REFRESH_PARTITIONSBase table partitions involved in the most recent refresh task
LAST_REFRESH_MV_REFRESH_PARTITIONSMaterialized view partitions refreshed in the most recent refresh task
LAST_REFRESH_ERROR_CODEError code of the most recent refresh task
LAST_REFRESH_ERROR_MESSAGEError message of the most recent refresh task
TABLE_ROWSNumber of data rows in the materialized view, based on approximate background statistics
MATERIALIZED_VIEW_DEFINITIONSQL definition of the materialized view