SHOW THREADS [ OPTION columns=width[,format=sphinxql][,format=all] ]
SHOW THREADS 是一个 SQL 语句,用于显示所有线程及其当前活动的信息。
结果表包含以下列:
TID:内核分配给线程的 IDName:线程名称,也可在top、htop、ps及其他进程查看工具中看到Proto:连接协议;可能的值包括sphinx、mysql、http、ssl、compressed、replication,或组合(例如http,ssl或compressed,mysql)State:线程状态;可能的值有handshake、net_read、net_write、query、net_idleConnection from:客户端的ip:portConnID:连接 ID(从 0 开始)This/prev job time:当线程忙碌时 - 当前任务运行的时间;当线程空闲时 - 上一个任务的持续时间 + 后缀prevJobs done:该线程完成的任务数量Thread status:idling或workingInfo:查询信息,如果查询针对分布式表或实时表,可能包含多个查询
‹›
- SQL
- JSON
- PHP
- Python
- Python-asyncio
- javascript
- Java
- C#
- Rust
- TypeScript
- Go
📋
⚙
SHOW THREADS;POST /cli -d "SHOW THREADS"require_once __DIR__ . '/vendor/autoload.php';
$config = ['host'=>'127.0.0.1','port'=>9308];
$client = new \Manticoresearch\Client($config);
print_r($client->nodes()->threads());import manticoresearch
config = manticoresearch.Configuration(
host = "http://127.0.0.1:9308"
)
client = manticoresearch.ApiClient(config)
utilsApi = manticoresearch.UtilsApi(client)
print(utilsApi.sql('SHOW THREADS'))import manticoresearch
config = manticoresearch.Configuration(
host = "http://127.0.0.1:9308"
)
client = manticoresearch.ApiClient(config)
utilsApi = manticoresearch.UtilsApi(client)
res = await utilsApi.sql('SHOW THREADS')
print(res)var Manticoresearch = require('manticoresearch');
var utilsApi = new Manticoresearch.UtilsApi();
async function showThreads() {
res = await utilsApi.sql('SHOW THREADS');
console.log(JSON.stringify(res, null, 4));
}
showThreads();utilsApi.sql("SHOW THREADS");utilsApi.Sql("SHOW THREADS");utils_api.sql("SHOW THREADS", Some(true)).await;res = await utilsApi.sql('SHOW THREADS');apiClient.UtilsAPI.Sql(context.Background()).Body("SHOW THREADS").Execute()
‹›
Response
*************************** 1. row ***************************
TID: 83
Name: work_1
Proto: mysql
State: query
Connection from: 172.17.0.1:43300
ConnID: 8
This/prev job time: 630us
CPU activity: 94%
Jobs done: 2490
Thread status: working
Info: SHOW THREADS
*************************** 2. row ***************************
TID: 84
Name: work_2
Proto: mysql
State: query
Connection from: 172.17.0.1:43301
ConnID: 9
This/prev job time: 689us
CPU activity: 89%
Jobs done: 1830
Thread status: working
Info: show threads+--------+---------+-------+-------+-----------------+--------+-----------------------+-----------+---------------+--------------+
| TID | Name | Proto | State | Connection from | ConnID | This/prev job time, s | Jobs done | Thread status | Info |
+--------+---------+-------+-------+-----------------+--------+-----------------------+-----------+---------------+--------------+
| 501494 | work_23 | http | query | 127.0.0.1:41300 | 1473 | 249us | 1681 | working | show_threads |
+--------+---------+-------+-------+-----------------+--------+-----------------------+-----------+---------------+--------------+Array
(
[0] => Array
(
[TID] => 506960
[Name] => work_8
[Proto] => http
[State] => query
[Connection from] => 127.0.0.1:38072
[ConnID] => 17
[This/prev job time, s] => 231us
[CPU activity] => 94%
[Jobs done] => 8
[Thread status] => working
[Info] => show_threads
)
)[{'columns': [{'TID': {'type': 'long'}}, {'Name': {'type': 'string'}}, {'Proto': {'type': 'string'}}, {'State': {'type': 'string'}}, {'Connection from': {'type': 'string'}}, {'ConnID': {'type': 'long long'}}, {'This/prev job time, s': {'type': 'string'}}, {'CPU activity': {'type': 'string'}}, {'Jobs done': {'type': 'long'}}, {'Thread status': {'type': 'string'}}, {'Info': {'type': 'string'}}], 'data': [{'TID': 506958, 'Name': 'work_6', 'Proto': 'http', 'State': 'query', 'Connection from': '127.0.0.1:38600', 'ConnID': 834, 'This/prev job time, s': '206us', 'CPU activity': '92%', 'Jobs done': 943, 'Thread status': 'working', 'Info': 'show_threads'}], 'total': 1, 'error': '', 'warning': ''}][{'columns': [{'TID': {'type': 'long'}}, {'Name': {'type': 'string'}}, {'Proto': {'type': 'string'}}, {'State': {'type': 'string'}}, {'Connection from': {'type': 'string'}}, {'ConnID': {'type': 'long long'}}, {'This/prev job time, s': {'type': 'string'}}, {'CPU activity': {'type': 'string'}}, {'Jobs done': {'type': 'long'}}, {'Thread status': {'type': 'string'}}, {'Info': {'type': 'string'}}], 'data': [{'TID': 506958, 'Name': 'work_6', 'Proto': 'http', 'State': 'query', 'Connection from': '127.0.0.1:38600', 'ConnID': 834, 'This/prev job time, s': '206us', 'CPU activity': '92%', 'Jobs done': 943, 'Thread status': 'working', 'Info': 'show_threads'}], 'total': 1, 'error': '', 'warning': ''}][
{
"columns": [
{
"TID": {
"type": "long"
}
},
{
"Name": {
"type": "string"
}
},
{
"Proto": {
"type": "string"
}
},
{
"State": {
"type": "string"
}
},
{
"Connection from": {
"type": "string"
}
},
{
"ConnID": {
"type": "long long"
}
},
{
"This/prev job time, s": {
"type": "string"
}
},
{
"CPU activity": {
"type": "string"
}
},
{
"Jobs done": {
"type": "long"
}
},
{
"Thread status": {
"type": "string"
}
},
{
"Info": {
"type": "string"
}
}
],
"data": [
{
"TID": 506964,
"Name": "work_12",
"Proto": "http",
"State": "query",
"Connection from": "127.0.0.1:36656",
"ConnID": 2884,
"This/prev job time, s": "236us",
"CPU activity": "92%",
"Jobs done": 3328,
"Thread status": "working",
"Info": "show_threads"
}
],
"total": 1,
"error": "",
"warning": ""
}
]{
columns=[
{
TID={
type=string
}
},
{
Name={
type=string
}
},
{
Proto={
type=string
}
},
{
State={
type=string
}
},
{
Connection from={
type=string
}
},
{
ConnID={
type=string
}
},
{
This/prev job time={
type=string
}
},
{
CPU activity={
type=string
}
},
{
Jobs done={
type=string
}
},
{
Thread status={
type=string
}
},
{
Info={
type=string
}
}
],
data=[
{
TID=82,
Name=work_0,
Proto=http,
State=query,
Connection from=172.17.0.1:60550,
ConnID=163,
This/prev job time=105us,
CPU activity=45%,
Jobs done=849,
Thread status=working,
Info=show_threads
}
],
total=0,
error=,
warning=
}{
columns=[
{
TID={
type=string
}
},
{
Name={
type=string
}
},
{
Proto={
type=string
}
},
{
State={
type=string
}
},
{
Connection from={
type=string
}
},
{
ConnID={
type=string
}
},
{
This/prev job time= {
type=string
}
},
{
Jobs done={
type=string
}
},
{
Thread status={
type=string
}
},
{
Info={
type=string
}
}
],
data=[
{
TID=83,
Name=work_1,
Proto=http,
State=query,
Connection from=172.17.0.1:41410,
ConnID=6,
This/prev job time=689us,
Jobs done=159,
Thread status=working,
Info=show_threads
}
],
total=0,
error="",
warning=""
}{
columns=[
{
TID={
type=string
}
},
{
Name={
type=string
}
},
{
Proto={
type=string
}
},
{
State={
type=string
}
},
{
Connection from={
type=string
}
},
{
ConnID={
type=string
}
},
{
This/prev job time= {
type=string
}
},
{
Jobs done={
type=string
}
},
{
Thread status={
type=string
}
},
{
Info={
type=string
}
}
],
data=[
{
TID=83,
Name=work_1,
Proto=http,
State=query,
Connection from=172.17.0.1:41410,
ConnID=6,
This/prev job time=689us,
Jobs done=159,
Thread status=working,
Info=show_threads
}
],
total=0,
error="",
warning=""
}[
{
"columns": [
{
"TID": {
"type": "long"
}
},
{
"Name": {
"type": "string"
}
},
{
"Proto": {
"type": "string"
}
},
{
"State": {
"type": "string"
}
},
{
"Connection from": {
"type": "string"
}
},
{
"ConnID": {
"type": "long long"
}
},
{
"This/prev job time, s": {
"type": "string"
}
},
{
"CPU activity": {
"type": "string"
}
},
{
"Jobs done": {
"type": "long"
}
},
{
"Thread status": {
"type": "string"
}
},
{
"Info": {
"type": "string"
}
}
],
"data": [
{
"TID": 506964,
"Name": "work_12",
"Proto": "http",
"State": "query",
"Connection from": "127.0.0.1:36656",
"ConnID": 2884,
"This/prev job time, s": "236us",
"CPU activity": "92%",
"Jobs done": 3328,
"Thread status": "working",
"Info": "show_threads"
}
],
"total": 1,
"error": "",
"warning": ""
}
][
{
"columns": [
{
"TID": {
"type": "long"
}
},
{
"Name": {
"type": "string"
}
},
{
"Proto": {
"type": "string"
}
},
{
"State": {
"type": "string"
}
},
{
"Connection from": {
"type": "string"
}
},
{
"ConnID": {
"type": "long long"
}
},
{
"This/prev job time, s": {
"type": "string"
}
},
{
"CPU activity": {
"type": "string"
}
},
{
"Jobs done": {
"type": "long"
}
},
{
"Thread status": {
"type": "string"
}
},
{
"Info": {
"type": "string"
}
}
],
"data": [
{
"TID": 506964,
"Name": "work_12",
"Proto": "http",
"State": "query",
"Connection from": "127.0.0.1:36656",
"ConnID": 2884,
"This/prev job time, s": "236us",
"CPU activity": "92%",
"Jobs done": 3328,
"Thread status": "working",
"Info": "show_threads"
}
],
"total": 1,
"error": "",
"warning": ""
}
]Info 列显示:
- 通过 Manticore SQL 接口执行的查询的原始文本
- 通过内部 Manticore 二进制协议执行的查询的完整文本语法、注释和数据大小(例如,来自远程 Manticore 实例)
您可以通过指定 columns=N 选项限制 Info 列的最大宽度。
默认情况下,查询以其原始格式显示。但当使用 format=sphinxql 选项时,无论执行协议如何,查询都会以 SQL 格式显示。
使用 format=all 将显示所有线程,而不使用此选项时,空闲和系统线程会被隐藏(例如,忙于执行 OPTIMIZE 的线程)。
‹›
- SQL
- JSON
- PHP
- Python
- Python-asyncio
- javascript
- Java
- C#
- Rust
- TypeScript
- Go
📋
⚙
SHOW THREADS OPTION columns=30\GPOST /cli -d "SHOW THREADS OPTION columns=30"$client->nodes()->threads(['body'=>['columns'=>30]]);utilsApi.sql('SHOW THREADS OPTION columns=30')await utilsApi.sql('SHOW THREADS OPTION columns=30')res = await utilsApi.sql('SHOW THREADS OPTION columns=30');utilsApi.sql("SHOW THREADS OPTION columns=30");utilsApi.Sql("SHOW THREADS OPTION columns=30");utils_api.sql("SHOW THREADS OPTION columns=30", Some(true)).await;res = await utilsApi.sql('SHOW THREADS OPTION columns=30');apiClient.UtilsAPI.Sql(context.Background()).Body("SHOW THREADS OPTION columns=30").Execute()Last modified: August 28, 2025
SHOW QUERIES
注意:
SHOW QUERIES需要 Manticore Buddy。如果它不起作用,请确保已安装 Buddy。
SHOW QUERIES 返回所有当前正在运行的查询的信息。输出是一个具有以下结构的表:
‹›
- SQL
SQL
📋
⚙
mysql> SHOW QUERIES;
‹›
Response
+------+--------------+---------+----------+-----------------+
| id | query | time | protocol | host |
+------+--------------+---------+----------+-----------------+
| 111 | select | 5ms ago | http | 127.0.0.1:58986 |
| 96 | SHOW QUERIES | 255us | mysql | 127.0.0.1:33616 |
+------+--------------+---------+----------+-----------------+
2 rows in set (0.61 sec)如果您想从线程本身的角度获取信息,请参阅 SHOW THREADS。
Last modified: August 28, 2025
SHOW VERSION
注意:
SHOW VERSION需要 Manticore Buddy。如果无法使用,请确保已安装 Buddy。
SHOW VERSION 提供 Manticore Search 实例中各个组件的详细版本信息。该命令对于需要验证所运行的 Manticore Search 版本及其相关组件版本的管理员和开发人员特别有用。
输出表包含两列:
Component:此列显示 Manticore Search 的具体组件名称。Version:此列显示相应组件的版本信息。
‹›
- SQL
SQL
📋
⚙
mysql> SHOW VERSION;
‹›
Response
+------------+--------------------------------+
| Component | Version |
+------------+--------------------------------+
| Daemon | 6.2.13 61cfe38d2@24011520 dev |
| Columnar | columnar 2.2.5 214ce90@240115 |
| Secondary | secondary 2.2.5 214ce90@240115 |
| Knn | knn 2.2.5 214ce90@240115 |
| Embeddings | embeddings 1.0.0 |
| Buddy | buddy v2.0.11 |
+------------+--------------------------------+Last modified: August 28, 2025
KILL <query id>
KILL 通过查询的 ID 终止查询的执行,您可以在 SHOW QUERIES 中找到该 ID。
‹›
- SQL
SQL
📋
⚙
mysql> KILL 4;
Query OK, 1 row affected (0.00 sec)Last modified: August 28, 2025