Description:
I tried the pfs example from this manual page:
https://dev.mysql.com/doc/refman/8.0/en/memory-use.html
It produced a warning.
How to repeat:
mysql [localhost:8016] {msandbox} ((none)) > SELECT SUBSTRING_INDEX(event_name,'/',2) AS code_area, sys.format_bytes(SUM(current_alloc)) AS current_alloc FROM sys.x$memory_global_by_current_bytes GROUP BY SUBSTRING_INDEX(event_name,'/',2) ORDER BY SUM(current_alloc) DESC;
+---------------------------+---------------+
| code_area | current_alloc |
+---------------------------+---------------+
| memory/performance_schema | 266.76 MiB |
| memory/innodb | 185.10 MiB |
| memory/mysys | 8.57 MiB |
| memory/sql | 3.49 MiB |
| memory/temptable | 1.00 MiB |
| memory/mysqld_openssl | 130.29 KiB |
| memory/mysqlx | 3.44 KiB |
| memory/myisam | 696 bytes |
| memory/vio | 656 bytes |
| memory/csv | 88 bytes |
| memory/blackhole | 88 bytes |
+---------------------------+---------------+
11 rows in set, 1 warning (0.03 sec)
mysql [localhost:8016] {msandbox} ((none)) > show warnings;
+-------+------+---------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+---------------------------------------------------------------------+
| Note | 1585 | This function 'format_bytes' has the same name as a native function |
+-------+------+---------------------------------------------------------------------+
1 row in set (0.00 sec)
Suggested fix:
An easy fix, switch to the native function:
mysql [localhost:8016] {msandbox} ((none)) > SELECT SUBSTRING_INDEX(event_name,'/',2) AS code_area, format_bytes(SUM(current_alloc)) AS current_alloc FROM sys.x$memory_global_by_current_bytes GROUP BY SUBSTRING_INDEX(event_name,'/',2) ORDER BY SUM(current_alloc) DESC;
+---------------------------+---------------+
| code_area | current_alloc |
+---------------------------+---------------+
| memory/performance_schema | 266.76 MiB |
| memory/innodb | 185.10 MiB |
| memory/mysys | 8.57 MiB |
| memory/sql | 3.45 MiB |
| memory/temptable | 1.00 MiB |
| memory/mysqld_openssl | 130.29 KiB |
| memory/mysqlx | 3.44 KiB |
| memory/myisam | 696 bytes |
| memory/vio | 656 bytes |
| memory/csv | 88 bytes |
| memory/blackhole | 88 bytes |
+---------------------------+---------------+
11 rows in set (0.01 sec)