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. 从MySQL 8.0.16开始,MySQL包含了内置的SQL函数,这些函数格式化或检索性能架构数据,并且可以用作对应sys架构存储函数的等价物。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.内置函数可以在任何架构中调用,并且不需要限定符,不像sys函数需要sys.架构限定符或sys必须是当前架构。

Table 12.27 Performance Schema Functions性能架构函数

Name名称Description描述Introduced引入版本
FORMAT_BYTES()Convert byte count to value with units将字节计数转换为带单位的值8.0.16
FORMAT_PICO_TIME()Convert time in picoseconds to value with units将时间(皮秒)转换为单位值8.0.16
PS_CURRENT_THREAD_ID()Performance Schema thread ID for current thread当前线程的性能架构线程ID8.0.16
PS_THREAD_ID()Performance Schema thread ID for given thread给定线程的性能架构线程ID8.0.16

The built-in functions supersede the corresponding sys functions, which are deprecated; expect them to be removed in a future version of MySQL. 内置函数取代相应的sys函数,后者已被弃用;希望在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. 使用sys函数的应用程序应该调整为使用内置函数,记住sys函数和内置函数之间的一些细微差别。For details about these differences, see the function descriptions in this section.有关这些差异的详细信息,请参阅本节中的函数说明。