Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o0qaH-0005RR-GU for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Jun 2022 20:22:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o0qaG-0003VE-B8 for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Jun 2022 20:22:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o0qaG-0003V2-1u for pgsql-hackers@lists.postgresql.org; Mon, 13 Jun 2022 20:22:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o0qaD-0005nj-Q6 for pgsql-hackers@postgresql.org; Mon, 13 Jun 2022 20:22:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 25DKMgxo3920624; Mon, 13 Jun 2022 16:22:42 -0400 From: Tom Lane To: Robert Haas cc: David Fetter , PostgreSQL Development Subject: Re: Finer grain log timestamps In-reply-to: References: <20220508204451.GC11333@fetter.org> Comments: In-reply-to Robert Haas message dated "Mon, 13 Jun 2022 15:55:51 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3920622.1655151762.1@sss.pgh.pa.us> Date: Mon, 13 Jun 2022 16:22:42 -0400 Message-ID: <3920623.1655151762@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > On Sun, May 8, 2022 at 4:45 PM David Fetter wrote: >> Please find attached a patch to change the sub-second granularity of >> log timestamps from milliseconds to microseconds. > Why is this a good idea? I can imagine that some people would have a use for microsecond resolution in log files, and I can also imagine that as machines get faster more people will want that. As against that, this will bloat log files by a non-microscopic amount, and it's pretty likely to break some log-scanning tools too. It's unclear to me that that's a tradeoff we should force on everyone. I think a proposal less likely to have push-back would be to invent a different log_line_prefix %-escape to produce microseconds. Sadly, "%u" is already taken, but perhaps we could use "%U"? A different line of thought is to extend %t to provide a precision field a la sprintf, so that for example "%.3t" is equivalent to "%m" and "%.6t" does what David wants, and we won't have to search for a new escape letter when the day arrives that somebody wants nanosecond resolution. The same could be done with %n, avoiding the need to find a different escape letter for that. regards, tom lane