Syntax
FORMAT_PICO_TIME(time_val)
Purpose
FORMAT_PICO_TIME() converts the time_val value to a readable format and returns a string that consists of a value and a unit identifier. The result indicates the performance schema delay or waiting time, in picoseconds. The number of bytes of the string is rounded to two decimal places and contains at least three significant digits. Time less than 1 nanosecond is represented as an integer without rounding.
If the time_val value is NULL, this function returns NULL.
The unit identifier depends on the value of the time_val argument. The following table describes the argument values and unit identifiers.
| Value | Unit | Unit identifier |
|---|---|---|
| Up to 103 − 1 | picoseconds | ps |
| Up to 106 − 1 | nanoseconds | ns |
| Up to 109 − 1 | microseconds | μs |
| 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 or more | 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