Declaration
FORMAT_PICO_TIME(time_val)
Description
The FORMAT_PICO_TIME() function converts time_val to a readable format and returns a string consisting of the value and a unit identifier. The result represents the performance schema latency or wait time in picoseconds. The number of bytes in this 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, the function returns NULL.
The unit identifier depends on the value of the time_val parameter, as shown in the following table.
Parameter Value |
Result unit |
Unit Identifier |
|---|---|---|
| Up to 103 − 1 | picoseconds | ps |
| Up to 106 − 1 | nanoseconds | ns |
| Up to 109 − 1 | microseconds | us |
| Up to 1012 − 1 | milliseconds | ms |
| Up to 60×1012 − 1 | seconds | s |
| Up to 3.6×1015 − 1 | minutes | min |
| Up to 8.64×1016 − 1 | hours | h |
| 8.64×1016 and above | days | d |
Examples
obclient> 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