Waiting for 9.6 – Add log_line_prefix option ‘n’ for Unix epoch.

On 7th of September, Jeff Davis committed patch:

Add log_line_prefix option 'n' for Unix epoch.
 
Prints time as Unix epoch with milliseconds.
 
Tomas Vondra, reviewed by Fabien Coelho.

This could be useful, as it's simpler to calculate differences in epoch times than it is in timestamps.

So, let's see. Current, I have:

$ SHOW log_line_prefix ;
 log_line_prefix 
-----------------
 %m %u@%d %p %r 
(1 ROW)

And this logs lines like:

2015-09-22 19:29:19.286 CEST depesz@depesz 2925 [LOCAL] LOG:  duration: 0.058 ms  statement: SHOW log_line_prefix ;

If I'd change %m into %n, and run the same query:

$ SHOW log_line_prefix ;
 log_line_prefix 
-----------------
 %n %u@%d %p %r 
(1 ROW)

I'll get, much easier to work with in scripts:

1442943024.558 depesz@depesz 2925 [LOCAL] LOG:  duration: 0.033 ms  statement: SHOW log_line_prefix ;

Nice. I'm not actually big fan of epoch times, but I do realize that calculating difference between 1442943024.558 and 1442941298.516 is much easier than between ‘2015-09-22 17:30:24.558+00' and ‘2015-09-22 17:01:38.516+00'.

Thanks, guys.