Re: Expensive log_line_prefix ?

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>, "Sahagian, David" <david(dot)sahagian(at)emc(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Expensive log_line_prefix ?
Date: 2012-10-12 03:30:27
Message-ID: 20121012033027.GA12861@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane escribió:
> Sergey Konoplev <gray(dot)ru(at)gmail(dot)com> writes:
> > On Thu, Oct 11, 2012 at 12:19 PM, Sahagian, David
> > <david(dot)sahagian(at)emc(dot)com> wrote:
> >> Are there any "extra" costs to logging all this cool stuff ?
> >>
> >> log_line_prefix = '%m %a %u %p %c %m %v %x'
>
> > The formatting cost only but it is so insignificant that does not
> > worth bothering with it.
>
> IIRC, %m would imply a gettimeofday call, which might be expensive
> depending on your OS and hardware. I think all the other info is
> "just sitting around", though.

Yeah, and having two %m means two gettimeofday calls.

Also, %c sort of implies %p, so having both is probably just a waste.

One other point is that it's probably a good idea to put in a %q in
there so that processes that don't have things like %v, %x don't have to
print a bunch of zeros (and also to prevent %a, %u from adding spaces
unnecessarily).

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Condor 2012-10-12 07:47:09 Re: How to raise index points when equal and like is used with gist ?
Previous Message urkpostenardr 2012-10-12 02:55:33 Limit+Offset query wrong result in Postgres 9.0.3 ?