I’m trying to take some performance measurements of our stored procedures. I’ve already setup a debug table to log messages but is there any way to get milli- or microsecond precision? The timestamp field doesn’t offer this and I don’t see a way to get a time with either unix_timestamp() or now() or other functions with microseconds.
You could try building a function to return microseconds using the modifier:
%f - Microseconds (000000…999999)
However I’m not sure if DATE_FORMAT(NOW(), ‘you_format’) has microsecond precision. On my machine “SELECT DATE_FORMAT(NOW(), ‘%s %f’)” doesn’t give ms accuracy.
I’m surprised why MySQL for years can’t make accurate time counting implemented which is needed for a lot of things starting from internal counting to values in SHOW PROCESSLIST and slow query log.