Syntax
FORMAT_PICO_TIME(time_val)
Purpose
The FORMAT_PICO_TIME() function converts the time_val value to 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 and are not rounded.
If time_val is NULL, the function returns NULL.
The unit identifier depends on the size 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
