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. | data_length | UInt64 | | YES | | FIELD |
  10. | max_data_length | UInt64 | | YES | | FIELD |
  11. | index_length | UInt64 | | YES | | FIELD |
  12. | max_index_length | UInt64 | | YES | | FIELD |
  13. | avg_row_length | UInt64 | | YES | | FIELD |
  14. | engine | String | | YES | | FIELD |
  15. | version | UInt64 | | YES | | FIELD |
  16. | row_format | String | | YES | | FIELD |
  17. | table_rows | UInt64 | | YES | | FIELD |
  18. | data_free | UInt64 | | YES | | FIELD |
  19. | auto_increment | UInt64 | | YES | | FIELD |
  20. | create_time | DateTime | | YES | | FIELD |
  21. | update_time | DateTime | | YES | | FIELD |
  22. | check_time | DateTime | | YES | | FIELD |
  23. | table_collation | String | | YES | | FIELD |
  24. | checksum | UInt64 | | YES | | FIELD |
  25. | create_options | String | | YES | | FIELD |
  26. | table_comment | String | | YES | | FIELD |
  27. | temporary | String | | YES | | FIELD |
  28. +------------------+----------+------+------+---------+---------------+
  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: 1054
  7. data_length: 0
  8. max_data_length: 0
  9. index_length: 0
  10. max_index_length: 0
  11. avg_row_length: 0
  12. engine: mito
  13. version: 11
  14. row_format: Fixed
  15. table_rows: 0
  16. data_free: 0
  17. auto_increment: 0
  18. create_time: 2024-07-24 22:06:18.085000
  19. update_time: NULL
  20. check_time: NULL
  21. table_collation: NULL
  22. checksum: 0
  23. create_options:
  24. table_comment: NULL
  25. temporary: N
  26. 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.
  • version: Version. The value is 11 by default.
  • create_time: The table created timestamp.
  • table_comment: The table comment.
  • Other columns such as table_rows, row_format etc. are not supported, just for compatibility with MySQL. GreptimeDB may support some of them in the future.