Bug #70858 | Set thread name | ||
---|---|---|---|
Submitted: | 8 Nov 2013 8:58 | Modified: | 19 Oct 2021 12:10 |
Reporter: | Daniël van Eeden (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Performance Schema | Severity: | S4 (Feature request) |
Version: | 5.7, 8.0 | OS: | Any |
Assigned to: | Marc ALFF | CPU Architecture: | Any |
[8 Nov 2013 8:58]
Daniël van Eeden
[8 Nov 2013 9:10]
Daniël van Eeden
top will show this (Use 'H' to show threads) To show this info with ps: ps -Lo cmd:50,comm -p $(pidof mysqld),$(pidof firefox)
[1 Jan 2014 10:14]
MySQL Verification Team
Thanks for the feature request. The question is, what do we call the threads that are executing user queries? FWIW, at least on windows, the background threads already have appropriate names (see attached image).
[1 Jan 2014 10:15]
MySQL Verification Team
example
Attachment: threads_on_windows_5.6.15.png (image/png, text), 52.06 KiB.
[2 Jul 2015 6:16]
Daniël van Eeden
Related: https://github.com/dveeden/udf_pthread_name mysql> SELECT set_pthread_name('foobarbaz'); +-------------------------------+ | set_pthread_name('foobarbaz') | +-------------------------------+ | 0 | +-------------------------------+ 1 row in set (0.00 sec) mysql> \! ps -eLo pid,tid,comm | grep $(pgrep -x mysqld) 3880 3880 mysqld 3880 3881 mysqld 3880 3882 mysqld 3880 3883 mysqld 3880 3884 mysqld 3880 3885 mysqld 3880 3886 mysqld 3880 3887 mysqld 3880 3888 mysqld 3880 3889 mysqld 3880 3890 mysqld 3880 3893 mysqld 3880 3894 mysqld 3880 3895 mysqld 3880 3896 mysqld 3880 3897 mysqld 3880 3898 mysqld 3880 3899 mysqld 3880 3900 mysqld 3880 3901 mysqld 3880 3902 mysqld 3880 3911 foobarbaz This however only works for the current thread.
[18 Apr 2018 12:24]
Daniël van Eeden
The same but for ndbmtd: Bug #90495 Set thread name for ndbmtd
[19 Oct 2021 12:10]
Daniël van Eeden
Looks like this is fixed in 8.0.27 ( https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-27.html ) "To assist monitoring and troubleshooting, the Performance Schema instrumentation is now used to export names of instrumented threads to the operating system. This enables utilities that display thread names, such as debuggers and the Unix ps command, to display distinct mysqld thread names rather than “mysqld”. This feature is supported only on Linux, macOS, and Windows. For more information, see The setup_instruments Table."