Re: PATCH: numeric timestamp in log_line_prefix - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: PATCH: numeric timestamp in log_line_prefix
Date
Msg-id 1441660557.10365.28.camel@jeff-desktop
Whole thread Raw
In response to Re: PATCH: numeric timestamp in log_line_prefix  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: PATCH: numeric timestamp in log_line_prefix  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
> I wonder about this separate gettimeofday() call.  We already have
> formatted_log_time which is used for CSV logs and freeform log lines
> (stderr/syslog); if we introduce a separate gettimeofday() call here,
> and the user has %n in freeform log and CSV logging is active, the
> timings will diverge occasionally.
> 
> Maybe I'm worrying over nothing, because really what use case is there
> for having the two log formats enabled at the same time?  Yet somebody
> went some lengths to ensure they are consistent; I think we should do
> likewise here.

We now have three time-related options[1]: t, m, and n; and they each
acquire the time independently. Are you suggesting that we make all
three consistent, or only m and n?

The cleanest fix would be for the global variable to only hold the
timeval, and then format it once for the CSV log (always 'm' format) and
once for the regular log ('m', 'n', or 't'). If the regular log uses
'm', that would be some wasted cycles formatting it the same way twice.
Is it worth a little extra ugliness to cache both the timeval and the
formatted string?

Regards,Jeff Davis

[1] As of minutes ago, after I missed your message by a few minutes.





pgsql-hackers by date:

Previous
From: Petr Jelinek
Date:
Subject: Re: creating extension including dependencies
Next
From: Alvaro Herrera
Date:
Subject: Re: PATCH: numeric timestamp in log_line_prefix