SHOW THREADS [ OPTION columns=width[,format=sphinxql][,format=all] ]
SHOW THREADS
is an SQL statement that displays information about all threads and their current activities.
The resulting table contains the following columns:
TID
: ID assigned to the thread by the kernelName
: Thread name, also visible intop
,htop
,ps
, and other process-viewing toolsProto
: Connection protocol; possible values includesphinx
,mysql
,http
,ssl
,compressed
,replication
, or a combination (e.g.,http,ssl
orcompressed,mysql
)State
: Thread state; possible values arehandshake
,net_read
,net_write
,query
,net_idle
Connection from
: Client'sip:port
ConnID
: Connection ID (starting from 0)This/prev job time
: When the thread is busy - how long the current job has been running; when the thread is idling - previous job duration + suffixprev
Jobs done
: Number of jobs completed by this threadThread status
:idling
orworking
Info
: Information about the query, which may include multiple queries if the query targets a distributed table or a real-time table
- 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()
*************************** 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.15%
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.23%
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] => 93.54%
[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': 'float'}}, {'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': '91.85%', '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': 'float'}}, {'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': '91.85%', '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": "float"
}
},
{
"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": "91.73%",
"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=44.68%,
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": "float"
}
},
{
"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": "91.73%",
"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": "float"
}
},
{
"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": "91.73%",
"Jobs done": 3328,
"Thread status": "working",
"Info": "show_threads"
}
],
"total": 1,
"error": "",
"warning": ""
}
]
The Info
column displays:
- Raw text of queries executed via the Manticore SQL interface
- Full text syntax, comments, and data size for queries run through the internal Manticore binary protocol (e.g., from a remote Manticore instance)
You can limit the maximum width of the Info
column by specifying the columns=N
option.
By default, queries are displayed in their original format. However, when the format=sphinxql
option is used, queries will be shown in SQL format, regardless of the protocol used for execution.
Using format=all
will show all threads, while idling and system threads are hidden without this option (e.g., those busy with OPTIMIZE).
- SQL
- JSON
- PHP
- Python
- Python-asyncio
- javascript
- Java
- C#
- Rust
- TypeScript
- Go
SHOW THREADS OPTION columns=30\G
POST /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()
SHOW QUERIES
NOTE:
SHOW QUERIES
requires Manticore Buddy. If it doesn't work, make sure Buddy is installed.
SHOW QUERIES
returns information about all currently running queries. The output is a table with the following structure:
id
: Query ID that can be used in KILL to terminate the queryquery
: Query statement or a portion of ittime
: Time taken on command execution or how long ago the query was performed (in this case, the value will includeago
)protocol
: Connection protocol, with possible values beingsphinx
,mysql
,http
,ssl
,compressed
,replication
, or a combination (e.g.,http,ssl
orcompressed,mysql
)host
: Client'sip:port
- SQL
mysql> SHOW QUERIES;
+------+--------------+---------+----------+-----------------+
| 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)
Refer to SHOW THREADS if you'd like to gain insight from the perspective of the threads themselves.