WL#8853: PERFORMANCE_SCHEMA, ADD COLUMN THREADS.THREAD_OS_ID
Affects: Server-5.7
—
Status: Complete
Add a column THREAD_OS_ID to table performance_schema.threads Column DDL: ----------- `THREAD_OS_ID` bigint(20) unsigned DEFAULT NULL Semantic: --------- Expose the "TID", or thread/task identifier, as defined by the underlying operating system. For example with Linux, this corresponds to gettid(). TID is a field exposed in particular: - in perf: http://man7.org/linux/man-pages/man1/perf-stat.1.html - is ps -L: http://man7.org/linux/man-pages/man1/ps.1.html - in /proc/[pid]/task/[tid]: http://man7.org/linux/man-pages/man5/proc.5.html For Windows, the thread id is visible in Process Explorer: https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx Benefits: --------- By exposing the thread TID in the performance schema, a dba can correlate: - a user session (see existing column PROCESSLIST_ID) - a server thread (see existing column THREAD_ID) - to an operating system Light Weigh Process (LWP), aka a thread, with new column THREAD_OS_ID. This is critical to inspect / monitor MySQL server threads with tools external to the server itself, such as linux perf. User Documentation ================== * http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-9.html * http://dev.mysql.com/doc/refman/5.7/en/threads-table.html
Requirements ============ (1) Table performance_schema.threads. ------------------------------------- Func-Req (1.1): A fresh MySQL installation of CURRENT-VERSION must create the table performance_schema.threads with the new THREAD_OS_ID column. Func-Req (1.2): An upgrade from PREVIOUS-VERSION to CURRENT-VERSION must create the table performance_schema.threads with the new THREAD_OS_ID column. Func-Req (1.3): Column threads.THREAD_OS_ID is read-only, by users with the proper grants. Func-Req (1.4): When a MySQL thread is associated to the same operating system thread for its lifetime, column THREAD_OS_ID contains the operating system thread id. Func-Req (1.5): When a MySQL thread is not associated to the same operating system thread for its lifetime, column THREAD_OS_ID contains NULL. Note: this typically happens for the thread_pool, as a user session is not permanently associated to a worker thread, to the THREAD_OS_ID column will be NULL for user sessions.
Copyright (c) 2000, 2024, Oracle Corporation and/or its affiliates. All rights reserved.