Skip to main content

Information_Schema Database

TDengine includes a built-in database named INFORMATION_SCHEMA to provide access to database metadata, system information, and status information. This information includes database names, table names, and currently running SQL statements. All information related to TDengine maintenance is stored in this database. It contains several read-only tables. These tables are more accurately described as views, and they do not correspond to specific files. You can query these tables but cannot write data to them. The INFORMATION_SCHEMA database is intended to provide a unified method for SHOW commands to access data. However, using SELECT ... FROM INFORMATION_SCHEMA.tablename offers several advantages over SHOW commands:

  1. You can use a USE statement to specify the INFORMATION_SCHEMA database as the current database.
  2. You can use the familiar SELECT syntax to access information, provided that you know the table and column names.
  3. You can filter and order the query results. More generally, you can use any SELECT syntax that TDengine supports to query the INFORMATION_SCHEMA database.
  4. Future versions of TDengine can add new columns to INFORMATION_SCHEMA tables without affecting existing business systems.
  5. It is easier for users coming from other database management systems. For example, Oracle users can query data dictionary tables.
info
  • SHOW statements are still supported for the convenience of existing users.
  • Some columns in the system table may be keywords, and you need to use the escape character '`' when querying, for example, to query the VGROUPS in the database test:
   select `vgroups` from ins_databases where name = 'test';

This document introduces the tables of INFORMATION_SCHEMA and their structure.

INS_DNODES

Provides information about dnodes. Similar to SHOW DNODES. Users whose SYSINFO attribute is 0 can't view this table.

#ColumnData TypeDescription
1vnodesSMALLINTCurrent number of vnodes on the dnode. It should be noted that vnodes is a TDengine keyword and needs to be escaped with ` when used as a column name.
2support_vnodesSMALLINTMaximum number of vnodes on the dnode
3statusVARCHAR(10)Current status
4noteVARCHAR(256)Reason for going offline or other information
5idSMALLINTDnode ID
6endpointVARCHAR(134)Dnode endpoint
7createTIMESTAMPCreation time

INS_MNODES

Provides information about mnodes. Similar to SHOW MNODES. Users whose SYSINFO attribute is 0 can't view this table.

#ColumnData TypeDescription
1idSMALLINTMnode ID
2endpointVARCHAR(134)Mnode endpoint
3roleVARCHAR(10)Current role
4role_timeTIMESTAMPTime at which the current role was assumed
5create_timeTIMESTAMPCreation time

INS_QNODES

Provides information about qnodes. Similar to SHOW QNODES. Users whose SYSINFO attribute is 0 can't view this table.

#ColumnData TypeDescription
1idSMALLINTQnode ID
2endpointVARCHAR(134)Qnode endpoint
3create_timeTIMESTAMPCreation time

INS_SNODES

Provides information about snodes. Similar to SHOW SNODES. Users whose SYSINFO attribute is 0 can't view this table.

#ColumnData TypeDescription
1idSMALLINTSnode ID
2endpointVARCHAR(134)Snode endpoint
3create_timeTIMESTAMPCreation time

INS_CLUSTER

Provides information about the cluster. Users whose SYSINFO attribute is 0 can't view this table.

#ColumnData TypeDescription
1idBIGINTCluster ID
2nameVARCHAR(134)Cluster name
3create_timeTIMESTAMPCreation time

INS_DATABASES

Provides information about user-created databases. Similar to SHOW DATABASES.

#ColumnData TypeDescription
1nameVARCHAR(64)Database name
2create_timeTIMESTAMPCreation time
3ntablesINTNumber of standard tables and subtables (not including supertables)
4vgroupsINTNumber of vgroups. It should be noted that vnodes is a TDengine keyword and needs to be escaped with ` when used as a column name.
6replicaINTNumber of replicas. It should be noted that replica is a TDengine keyword and needs to be escaped with ` when used as a column name.
7strictVARCHAR(4)Obsoleted
8durationVARCHAR(10)Duration for storage of single files. It should be noted that duration is a TDengine keyword and needs to be escaped with ` when used as a column name.
9keepVARCHAR(32)Data retention period. It should be noted that keep is a TDengine keyword and needs to be escaped with ` when used as a column name.
10bufferINTWrite cache size per vnode, in MB. It should be noted that buffer is a TDengine keyword and needs to be escaped with ` when used as a column name.
11pagesizeINTPage size for vnode metadata storage engine, in KB. It should be noted that pagesize is a TDengine keyword and needs to be escaped with ` when used as a column name.
12pagesINTNumber of pages per vnode metadata storage engine. It should be noted that pages is a TDengine keyword and needs to be escaped with ` when used as a column name.
13minrowsINTMaximum number of records per file block. It should be noted that minrows is a TDengine keyword and needs to be escaped with ` when used as a column name.
14maxrowsINTMinimum number of records per file block. It should be noted that maxrows is a TDengine keyword and needs to be escaped with ` when used as a column name.
15compINTCompression method. It should be noted that comp is a TDengine keyword and needs to be escaped with ` when used as a column name.
16precisionVARCHAR(2)Time precision. It should be noted that precision is a TDengine keyword and needs to be escaped with ` when used as a column name.
17statusVARCHAR(10)Current database status
18retentionsVARCHAR(60)Aggregation interval and retention period. It should be noted that retentions is a TDengine keyword and needs to be escaped with ` when used as a column name.
19single_stableBOOLWhether the database can contain multiple supertables. It should be noted that single_stable is a TDengine keyword and needs to be escaped with ` when used as a column name.
20cachemodelVARCHAR(60)Caching method for the newest data. It should be noted that cachemodel is a TDengine keyword and needs to be escaped with ` when used as a column name.
21cachesizeINTMemory per vnode used for caching the newest data. It should be noted that cachesize is a TDengine keyword and needs to be escaped with ` when used as a column name.
22wal_levelINTWAL level. It should be noted that wal_level is a TDengine keyword and needs to be escaped with ` when used as a column name.
23wal_fsync_periodINTInterval at which WAL is written to disk. It should be noted that wal_fsync_period is a TDengine keyword and needs to be escaped with ` when used as a column name.
24wal_retention_periodINTWAL retention period, in second. It should be noted that wal_retention_period is a TDengine keyword and needs to be escaped with ` when used as a column name.
25wal_retention_sizeINTMaximum WAL size. It should be noted that wal_retention_size is a TDengine keyword and needs to be escaped with ` when used as a column name.
26stt_triggerSMALLINTThe threshold for number of files to trigger file merging. It should be noted that stt_trigger is a TDengine keyword and needs to be escaped with ` when used as a column name.
27table_prefixSMALLINTThe prefix length in the table name that is ignored when distributing table to vnode based on table name. It should be noted that table_prefix is a TDengine keyword and needs to be escaped with ` when used as a column name.
28table_suffixSMALLINTThe suffix length in the table name that is ignored when distributing table to vnode based on table name. It should be noted that table_suffix is a TDengine keyword and needs to be escaped with ` when used as a column name.
29tsdb_pagesizeINTThe page size for internal storage engine, its unit is KB. It should be noted that tsdb_pagesize is a TDengine keyword and needs to be escaped with ` when used as a column name.

INS_FUNCTIONS

Provides information about user-defined functions.

#ColumnData TypeDescription
1nameVARCHAR(64)Function name
2commentVARCHAR(255)Function description. It should be noted that comment is a TDengine keyword and needs to be escaped with ` when used as a column name.
3aggregateINTWhether the UDF is an aggregate function. It should be noted that aggregate is a TDengine keyword and needs to be escaped with ` when used as a column name.
4output_typeVARCHAR(31)Output data type
5create_timeTIMESTAMPCreation time
6code_lenINTLength of the source code
7bufsizeINTBuffer size
8func_languageVARCHAR(31)UDF programming language
9func_bodyVARCHAR(16384)UDF function body
10func_versionINTUDF function version. starting from 0. Increasing by 1 each time it is updated

INS_INDEXES

Provides information about user-created indices. Similar to SHOW INDEX.

#ColumnData TypeDescription
1db_nameVARCHAR(32)Database containing the table with the specified index
2table_nameVARCHAR(192)Table containing the specified index
3index_nameVARCHAR(192)Index name
4db_nameVARCHAR(64)Index column
5index_typeVARCHAR(10)SMA or tag index
6index_extensionsVARCHAR(256)Other information For SMA/tag indices, this shows a list of functions

INS_STABLES

Provides information about supertables.

#ColumnData TypeDescription
1stable_nameVARCHAR(192)Supertable name
2db_nameVARCHAR(64)All databases in the supertable
3create_timeTIMESTAMPCreation time
4columnsINTNumber of columns
5tagsINTNumber of tags. It should be noted that tags is a TDengine keyword and needs to be escaped with ` when used as a column name.
6last_updateTIMESTAMPLast updated time
7table_commentVARCHAR(1024)Table description
8watermarkVARCHAR(64)Window closing time. It should be noted that watermark is a TDengine keyword and needs to be escaped with ` when used as a column name.
9max_delayVARCHAR(64)Maximum delay for pushing stream processing results. It should be noted that max_delay is a TDengine keyword and needs to be escaped with ` when used as a column name.
10rollupVARCHAR(128)Rollup aggregate function. It should be noted that rollup is a TDengine keyword and needs to be escaped with ` when used as a column name.

INS_TABLES

Provides information about standard tables and subtables.

#ColumnData TypeDescription
1table_nameVARCHAR(192)Table name
2db_nameVARCHAR(64)Database name
3create_timeTIMESTAMPCreation time
4columnsINTNumber of columns
5stable_nameVARCHAR(192)Supertable name
6uidBIGINTTable ID
7vgroup_idINTVgroup ID
8ttlINTTable time-to-live. It should be noted that ttl is a TDengine keyword and needs to be escaped with ` when used as a column name.
9table_commentVARCHAR(1024)Table description
10typeVARCHAR(20)Table type

INS_TAGS

#ColumnData TypeDescription
1table_nameVARCHAR(192)Table name
2db_nameVARCHAR(64)Database name
3stable_nameVARCHAR(192)Supertable name
4tag_nameVARCHAR(64)Tag name
5tag_typeVARCHAR(64)Tag type
6tag_valueVARCHAR(16384)Tag value

INS_COLUMNS

#ColumnData TypeDescription
1table_nameVARCHAR(192)Table name
2db_nameVARCHAR(64)Database name
3table_typeVARCHAR(21)Table type
4col_nameVARCHAR(64)Column name
5col_typeVARCHAR(32)Column type
6col_lengthINTColumn length
7col_precisionINTColumn precision
8col_scaleINTColumn scale
9col_nullableINTColumn nullable

INS_USERS

Provides information about TDengine users. Users whose SYSINFO attribute is 0 can't view this table.

#ColumnData TypeDescription
1nameVARCHAR(24)User name
2superTINYINTWether user is super user. 1 means yes; 0 means no.
3enableTINYINTWether user is enabled. 1 means yes; 0 means no.
4sysinfoTINYINTWether user can query system info. 1 means yes; 0 means no.
5create_timeTIMESTAMPCreate time
6allowed_hostVARCHAR(49152)IP whitelist

INS_GRANTS

Provides information about TDengine Enterprise Edition permissions. Users whose SYSINFO attribute is 0 can't view this table.

#ColumnData TypeDescription
1versionVARCHAR(9)Whether the deployment is a licensed or trial version
2cpu_coresVARCHAR(9)CPU cores included in license
3dnodesVARCHAR(10)Dnodes included in license. It should be noted that dnodes is a TDengine keyword and needs to be escaped with ` when used as a column name.
4streamsVARCHAR(10)Streams included in license. It should be noted that streams is a TDengine keyword and needs to be escaped with ` when used as a column name.
5usersVARCHAR(10)Users included in license. It should be noted that users is a TDengine keyword and needs to be escaped with ` when used as a column name.
6accountsVARCHAR(10)Accounts included in license. It should be noted that accounts is a TDengine keyword and needs to be escaped with ` when used as a column name.
7storageVARCHAR(21)Storage space included in license. It should be noted that storage is a TDengine keyword and needs to be escaped with ` when used as a column name.
8connectionsVARCHAR(21)Client connections included in license. It should be noted that connections is a TDengine keyword and needs to be escaped with ` when used as a column name.
9databasesVARCHAR(11)Databases included in license. It should be noted that databases is a TDengine keyword and needs to be escaped with ` when used as a column name.
10speedVARCHAR(9)Write speed specified in license (data points per second)
11querytimeVARCHAR(9)Total query time specified in license
12timeseriesVARCHAR(21)Number of metrics included in license
13expiredVARCHAR(5)Whether the license has expired
14expire_timeVARCHAR(19)When the trial period expires

INS_VGROUPS

Provides information about vgroups. Users whose SYSINFO attribute is 0 can't view this table.

#ColumnData TypeDescription
1vgroup_idINTVgroup ID
2db_nameVARCHAR(32)Database name
3tablesINTTables in vgroup. It should be noted that tables is a TDengine keyword and needs to be escaped with ` when used as a column name.
4statusVARCHAR(10)Vgroup status
5v1_dnodeINTDnode ID of first vgroup member
6v1_statusVARCHAR(10)Status of first vgroup member
7v2_dnodeINTDnode ID of second vgroup member
8v2_statusVARCHAR(10)Status of second vgroup member
9v3_dnodeINTDnode ID of third vgroup member
10v3_statusVARCHAR(10)Status of third vgroup member
11nfilesINTNumber of data and metadata files in the vgroup
12file_sizeINTSize of the data and metadata files in the vgroup
13tsmaTINYINTWhether time-range-wise SMA is enabled. 1 means enabled; 0 means disabled.

INS_CONFIGS

Provides system configuration information.

#ColumnData TypeDescription
1nameVARCHAR(32)Parameter
2valueVARCHAR(64)Value. It should be noted that value is a TDengine keyword and needs to be escaped with ` when used as a column name.

INS_DNODE_VARIABLES

Provides dnode configuration information. Users whose SYSINFO attribute is 0 can't view this table.

#ColumnData TypeDescription
1dnode_idINTDnode ID
2nameVARCHAR(32)Parameter
3valueVARCHAR(64)Value. It should be noted that value is a TDengine keyword and needs to be escaped with ` when used as a column name.

INS_TOPICS

#ColumnData TypeDescription
1topic_nameVARCHAR(192)Topic name
2db_nameVARCHAR(64)Database for the topic
3create_timeTIMESTAMPCreation time
4sqlVARCHAR(1024)SQL statement used to create the topic

INS_SUBSCRIPTIONS

#ColumnData TypeDescription
1topic_nameVARCHAR(204)Subscribed topic
2consumer_groupVARCHAR(193)Subscribed consumer group
3vgroup_idINTVgroup ID for the consumer
4consumer_idBIGINTConsumer ID
5offsetVARCHAR(64)Consumption progress
6rowsBIGINTNumber of consumption items

INS_STREAMS

#ColumnData TypeDescription
1stream_nameVARCHAR(64)Stream name
2create_timeTIMESTAMPCreation time
3sqlVARCHAR(1024)SQL statement used to create the stream
4statusVARCHAR(20)Current status
5source_dbVARCHAR(64)Source database
6target_dbVARCHAR(64)Target database
7target_tableVARCHAR(192)Target table
8watermarkBIGINTWatermark (see stream processing documentation). It should be noted that watermark is a TDengine keyword and needs to be escaped with ` when used as a column name.
9triggerINTMethod of triggering the result push (see stream processing documentation). It should be noted that trigger is a TDengine keyword and needs to be escaped with ` when used as a column name.

INS_USER_PRIVILEGES

Users whose SYSINFO attribute is 0 can't view this table.

| # | Column | Data Type | Description |** | | --- | :----------: | ------------ | -------------------------------------------| | 1 | user_name | VARCHAR(24) | Username | | 2 | privilege | VARCHAR(10) | Privilege description | | 3 | db_name | VARCHAR(65) | Database name | | 4 | table_name | VARCHAR(193) | Table name | | 5 | condition | VARCHAR(49152) | The privilege filter for child tables |