列出表

Manticore Search 对表只有单层层级结构。

与其他数据库管理系统不同,Manticore 中没有将表分组到数据库中的概念。然而,为了与 SQL 方言的互操作性,Manticore 接受 SHOW DATABASES 语句,但该语句不会返回任何结果。

SHOW TABLES

通用语法:

SHOW TABLES [ LIKE pattern ]

SHOW TABLES 语句列出所有当前活动的表及其类型。现有的表类型有 localdistributedrtpercolatetemplate

‹›
  • SQL
  • PHP
  • Python
  • Python-asyncio
  • javascript
  • Java
  • C#
  • Rust
📋
SHOW TABLES;
‹›
Response
+----------+-------------+
| Index    | Type        |
+----------+-------------+
| dist     | distributed |
| plain    | local       |
| pq       | percolate   |
| rt       | rt          |
| template | template    |
+----------+-------------+
5 rows in set (0.00 sec)

支持可选的 LIKE 子句,用于按名称过滤表。

‹›
  • SQL
  • PHP
  • Python
  • Python-asyncio
  • javascript
  • Java
  • C#
  • Rust
📋
SHOW TABLES LIKE 'pro%';
‹›
Response
+----------+-------------+
| Index    | Type        |
+----------+-------------+
| products | distributed |
+----------+-------------+
1 row in set (0.00 sec)

DESCRIBE

{DESC | DESCRIBE} table_name [ LIKE pattern ]

DESCRIBE 语句列出表的列及其相关类型。列包括文档 ID、全文字段和属性。顺序与 INSERTREPLACE 语句中字段和属性的预期顺序相匹配。列类型包括 fieldintegertimestampordinalboolfloatbigintstringmva。ID 列的类型为 bigint。示例:

mysql> DESC rt;
+---------+---------+
| Field   | Type    |
+---------+---------+
| id      | bigint  |
| title   | field   |
| content | field   |
| gid     | integer |
+---------+---------+
4 rows in set (0.00 sec)

支持可选的 LIKE 子句。语法详情请参阅 SHOW META

SELECT FROM name.@table

你也可以通过执行查询 select * from <table_name>.@table 来查看表结构。此方法的好处是可以使用 WHERE 子句进行过滤:

‹›
  • SQL
SQL
📋
select * from tbl.@table where type='text';
‹›
Response
+------+-------+------+----------------+
| id   | field | type | properties     |
+------+-------+------+----------------+
|    2 | title | text | indexed stored |
+------+-------+------+----------------+
1 row in set (0.00 sec)

你还可以对 <your_table_name>.@table 执行许多其他操作,将其视为具有整数和字符串属性列的常规 Manticore 表。

‹›
  • SQL
SQL
📋
select field from tbl.@table;
select field, properties from tbl.@table where type in ('text', 'uint');
select * from tbl.@table where properties any ('stored');

SHOW CREATE TABLE

SHOW CREATE TABLE table_name

打印用于创建指定表的 CREATE TABLE 语句。

‹›
  • SQL
SQL
📋
SHOW CREATE TABLE tbl\G
‹›
Response
       Table: tbl
Create Table: CREATE TABLE tbl (
f text indexed stored
) charset_table='non_cont,cont' morphology='icu_chinese'
1 row in set (0.00 sec)

Percolate 表结构

如果你对 percolate 表使用 DESC 语句,它将显示外部表结构,即存储查询的结构。此结构是静态的,所有本地 percolate 表相同:

mysql> DESC pq;
+---------+--------+
| Field   | Type   |
+---------+--------+
| id      | bigint |
| query   | string |
| tags    | string |
| filters | string |
+---------+--------+
4 rows in set (0.00 sec)

如果你想查看预期的文档结构,请使用以下命令: DESC <pq table name> table

mysql> DESC pq TABLE;
+-------+--------+
| Field | Type   |
+-------+--------+
| id    | bigint |
| title | text   |
| gid   | uint   |
+-------+--------+
3 rows in set (0.00 sec)

同时支持 desc pq table like ...,其工作方式如下:

mysql> desc pq table like '%title%';
+-------+------+----------------+
| Field | Type | Properties     |
+-------+------+----------------+
| title | text | indexed stored |
+-------+------+----------------+
1 row in set (0.00 sec)
Last modified: August 28, 2025