LP #728080: THREAD_STATISTICS is always empty
Description
Environment
Smart Checklist
Activity
Sveta Smirnova April 6, 2018 at 6:03 PM
Thank you for the report.
Described behavior is not repeatable with current version having thread_statistics is enabled.
lpjirasync January 22, 2018 at 3:29 PM
**Comment from Launchpad by: Laurynas Biveinis on: 13-07-2017 10:29:38
One argument for having a separate system variable for thread_statistics is that its memory usage grows rather fast when enabled, presumably much faster than for the rest of usertat: https://www.percona.com/blog/2017/07/11/thread_statistics-and-high-memory-usage/
lpjirasync January 22, 2018 at 3:29 PM
**Comment from Launchpad by: Alexey Kopytov on: 16-05-2012 07:37:23
I see no reasons for having a separate system variable to control thread_statistics. I think the fix for this bug would be to keep the variable for compatibility, but make thread stats enabled when userstat is ON.
lpjirasync January 22, 2018 at 3:29 PM
**Comment from Launchpad by: Alexey Kopytov on: 16-05-2012 07:35:26
And the reason for issue #2, i.e. thread_statistics being an empty table, is that to enable thread statistics collection, setting userstat to ON is insufficient, one also has to set the thread_statistics variable to ON (5.5 also requires quoting until bug #997036 is fixed):
mysql> select @@userstat;
------------
@@userstat |
------------
1 |
------------
1 row in set (0.00 sec)
mysql> select * from information_schema.thread_statistics;
Empty set (0.00 sec)
mysql> set global `thread_statistics`=on;
Query OK, 0 rows affected (0.01 sec)
mysql> select * from information_schema.thread_statistics\G
*************************** 1. row ***************************
THREAD_ID: 1
TOTAL_CONNECTIONS: 1
CONCURRENT_CONNECTIONS: 0
CONNECTED_TIME: 2
BUSY_TIME: 0
CPU_TIME: 0
BYTES_RECEIVED: 55
BYTES_SENT: 0
BINLOG_BYTES_WRITTEN: 0
ROWS_FETCHED: 1
ROWS_UPDATED: 0
TABLE_ROWS_READ: 0
SELECT_COMMANDS: 1
UPDATE_COMMANDS: 0
OTHER_COMMANDS: 0
COMMIT_TRANSACTIONS: 0
ROLLBACK_TRANSACTIONS: 0
DENIED_CONNECTIONS: 0
LOST_CONNECTIONS: 0
ACCESS_DENIED: 0
EMPTY_QUERIES: 0
1 row in set (0.00 sec)
lpjirasync January 22, 2018 at 3:29 PM
**Comment from Launchpad by: Alexey Kopytov on: 16-05-2012 05:24:57
There are 2 different issues:
1. THREAD_STATISTICS is a reserved word in 5.5. This is bug #997036.
2. THREAD_STATISTICS is always empty in both 5.1 and 5.5.
This report was originally about issue #1, so technically it's a duplicate of bug #997036 or the other way around. But since there's already some confusion on what this bug is about, let's keep it as a report about issue #2, and bug #997036 as a report about issue #1.
Changing summary and report accordingly.
Details
Assignee
UnassignedUnassignedReporter
lpjirasynclpjirasync(Deactivated)Labels
Priority
Low
Details
Details
Assignee
Reporter
Labels
Priority
Smart Checklist
Open Smart Checklist
Smart Checklist
Open Smart Checklist
Smart Checklist

**Reported in Launchpad by Swany last update 13-07-2017 10:29:38
Reproducible on both 5.1 and 5.5.
mysql> select @@userstat;
------------
@@userstat
------------
1
------------
1 row in set (0.00 sec)
mysql> show thread_statistics;
Empty set (0.00 sec)
mysql> select * from information_schema.thread_statistics;
Empty set (0.01 sec)