Топ-100
 

PS_THREAD_ID

База данных: MySQL
Текст

PS_THREAD_ID(connection_id)

Given a connection ID, returns a BIGINT UNSIGNED value representing the
Performance Schema thread ID assigned to the connection ID, or NULL if
no thread ID exists for the connection ID. The latter can occur for
threads that are not instrumented.

The connection ID argument is a value of the type given in the
PROCESSLIST_ID column of the Performance Schema threads table or the Id
column of SHOW PROCESSLIST output.

The thread ID return value is a value of the type given in the
THREAD_ID column of Performance Schema tables.

Performance Schema configuration affects PS_THREAD_ID() operation as
follows. (These remarks also apply to PS_CURRENT_THREAD_ID().)

o Disabling the thread_instrumentation consumer disables statistics
from being collected and aggregated at the thread level, but has no
effect on PS_THREAD_ID().

o If performance_schema_max_thread_instances is not 0, the Performance
Schema allocates memory for thread statistics and assigns an internal
ID to each thread for which instance memory is available. If there
are threads for which instance memory is not available,
PS_THREAD_ID() returns NULL; in this case,
Performance_schema_thread_instances_lost will be nonzero.

o If performance_schema_max_thread_instances is 0, the Performance
Schema allocates no thread memory and PS_THREAD_ID() returns NULL.

o If the Performance Schema itself is disabled, PS_THREAD_ID() produces
an error.

URL: https://dev.mysql.com/doc/refman/8.0/en/performance-schema-functions.html

Пример

mysql> SELECT PS_THREAD_ID(6);
+-----------------+
| PS_THREAD_ID(6) |
+-----------------+
| 45 |
+-----------------+