MySQL 8.0 Reference Manual Including MySQL NDB Cluster 8.0

12.22 Performance Schema Functions

As of MySQL 8.0.16, MySQL includes built-in SQL functions that format or retrieve Performance Schema data, and that may be used as equivalents for the corresponding sys schema stored functions. The built-in functions can be invoked in any schema and require no qualifier, unlike the sys functions, which require either a sys. schema qualifier or that sys be the current schema.

Table 12.28 Performance Schema Functions

Name Description
FORMAT_BYTES() Convert byte count to value with units
FORMAT_PICO_TIME() Convert time in picoseconds to value with units
PS_CURRENT_THREAD_ID() Performance Schema thread ID for current thread
PS_THREAD_ID() Performance Schema thread ID for given thread

The built-in functions supersede the corresponding sys functions, which are deprecated and will be removed in a future MySQL version. Applications that use the sys functions should be adjusted to use the built-in functions instead, keeping in mind some minor differences between the sys functions and the built-in functions. For details about these differences, see the function descriptions in this section.