Checking Connection Compression Usage

841 Views Asked by At

Is there a way to query of all the current connections and to see if they are using compression?

I know you can query your current connection using:

SHOW SESSION STATUS LIKE "Compression";

This will return a table with the value column saying ON or OFF.

However, this is not what I want. I would rather have something like SHOW PROCESSLIST that has a column indicating whether or not someone's connection has compression enabled.

2

There are 2 best solutions below

0
Kirk Backus On BEST ANSWER

Since compression is strictly in the scope of a session, it is currently impossible to query data from another session in MySQL directly.


Source: https://dba.stackexchange.com/a/65147/27603

Is there a way to see the SESSION variables of other active, connected users, from a superuser connection ?

No, there is no way.

0
Daniël van Eeden On

This is possible in MySQL with performance schema:

sql> SELECT * FROM performance_schema.status_by_thread WHERE VARIABLE_NAME 
LIKE 'Compression%';
+-----------+-----------------------+----------------+
| THREAD_ID | VARIABLE_NAME         | VARIABLE_VALUE |
+-----------+-----------------------+----------------+
|        55 | Compression           | ON             |
|        55 | Compression_algorithm | zstd           |
|        55 | Compression_level     | 3              |
|        56 | Compression           | OFF            |
|        56 | Compression_algorithm |                |
|        56 | Compression_level     | 0              |
+-----------+-----------------------+----------------+
6 rows in set (0.0012 sec)

sql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 8.0.33    |
+-----------+
1 row in set (0.0006 sec)

The original question was about MySQL 5.6, which probably didn't support this yet.