Skip to main content
Version: V1.0.0

FORMAT_PICO_TIME

Declaration

FORMAT_PICO_TIME(time_val)

Description

FORMAT_PICO_TIME() converts time_val into a readable format and returns a string that contains the value and the unit identifier. The result represents the Performance Schema latency or wait time in picoseconds. The number of bytes in the string is rounded to two decimal places and contains at least three significant digits. Times less than 1 nanosecond are represented as integers without rounding.

If time_val is NULL, this function returns NULL.

The unit identifier depends on the size of the time_val parameter, as shown in the following table.

Parameter ValueResult UnitUnit Identifier
Up to 103 − 1picosecondsps
Up to 106 − 1nanosecondsns
Up to 109 − 1microsecondsus
Up to 1012 − 1millisecondsms
Up to 60×1012 − 1secondss
Up to 3.6×1015 − 1minutesmin
Up to 8.64×1016 − 1hoursh
8.64×1016 and abovedaysd

Examples

SELECT FORMAT_PICO_TIME(2401), FORMAT_PICO_TIME(188732396662000);
+------------------------+-----------------------------------+
| FORMAT_PICO_TIME(2401) | FORMAT_PICO_TIME(188732396662000) |
+------------------------+-----------------------------------+
| 2.40 ns | 3.15 min |
+------------------------+-----------------------------------+
1 row in set (0.001 sec)