content_image/769720.jpg content_image/769721.jpg
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. 

<img src='content_image/769720.jpg'>

The built-in functions supersede the corresponding sys  functions, which are deprecated; expect them to be removed in a future version of MySQL. 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. 

• FORMAT_BYTES( count ) 

Given a numeric byte count, converts it to human-readable format and returns a string consisting of a value and a units indicator. The string contains the number of bytes rounded to 2 decimal places and a minimum of 3 significant digits. Numbers less than 1024 bytes are represented as whole numbers and are not rounded. 

The units indicator depends on the size of the byte-count argument as shown in the following table. 

<img src='content_image/769721.jpg'>

mysql> SELECT FORMAT_BYTES(512), FORMAT_BYTES(18446644073709551615); +-------------------+------------------------------------+ | FORMAT_BYTES(512) | FORMAT_BYTES(18446644073709551615) | +-------------------+------------------------------------+ | 512 bytes | 16.00 EiB | +-------------------+------------------------------------+ 

FORMAT_BYTES()  was added in MySQL 8.0.16. It may be used instead of the sys  schema format_bytes()  function, keeping in mind this difference: 

• FORMAT_BYTES()  uses the EiB  units indicator. sys.format_bytes()  does not. 

• FORMAT_PICO_TIME( time_val ) 

