TABLES

The TABLES table provides information about tables in databases:

  1. USE INFORMATION_SCHEMA;
  2. DESC TABLES;

The output is as follows:

  1. +---------------+--------+------+------+---------+---------------+
  2. | Column | Type | Key | Null | Default | Semantic Type |
  3. +---------------+--------+------+------+---------+---------------+
  4. | table_catalog | String | | NO | | FIELD |
  5. | table_schema | String | | NO | | FIELD |
  6. | table_name | String | | NO | | FIELD |
  7. | table_type | String | | NO | | FIELD |
  8. | table_id | UInt32 | | YES | | FIELD |
  9. | engine | String | | YES | | FIELD |
  10. +---------------+--------+------+------+---------+---------------+
  11. 6 rows in set (0.00 sec)
  1. SELECT * FROM tables WHERE table_schema='public' AND table_name='monitor'\G
  1. *************************** 1. row ***************************
  2. table_catalog: greptime
  3. table_schema: public
  4. table_name: monitor
  5. table_type: BASE TABLE
  6. table_id: 1025
  7. engine: mito
  8. 1 row in set (0.01 sec)

The following statements are equivalent:

  1. SELECT table_name FROM INFORMATION_SCHEMA.TABLES
  2. WHERE table_schema = '<db_name>'
  3. [AND table_name LIKE 'monitor']
  4. SHOW TABLES
  5. FROM db_name
  6. [LIKE 'monitor']

The description of columns in the TABLES table is as follows:

  • table_catalog: The catalog to which the table belongs. The value is always greptime.
  • table_schema: The database to which the table belongs.
  • table_name: The name of the table.
  • table_type: The type of the table.
    • BASE TABLE for a table.
    • TEMPORARY for a temporary result set.
    • VIEW for a view.
  • table_id: The ID of the table.
  • engine: The storage engine of the table used.