Skip site navigation (1) Skip section navigation (2)

Re: PG Logging is Slow

From: Theo Galanakis <Theo(dot)Galanakis(at)lonelyplanet(dot)com(dot)au>
To: 'Grega Bremec' <gregab(at)p0f(dot)net>
Cc: "'pgsql-performance(at)postgresql(dot)org'" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: PG Logging is Slow
Date: 2004-12-20 22:40:35
Message-ID: 16C0CF355FA04944A69E5A4F5299D30B110EAC@ganesh.au.lpint.net (view raw or flat)
Thread:
Lists: pgsql-performance
Thank-you Grega,

	I ended up using the pg_ctl -l parameter to write the output to a
specified file. Much quicker to do so.

	I tried the -/var/log/postgresql.log option however I noticed no
performance improvement. May be the fact that we use redhad linux and
syslog, I'm no sys-admin, so I'm not sure if there is a difference between
syslogd and syslog.

Theo

-----Original Message-----
From: Grega Bremec [mailto:gregab(at)p0f(dot)net] 
Sent: Monday, 20 December 2004 3:49 PM
To: Theo Galanakis
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] PG Logging is Slow


...and on Mon, Dec 20, 2004 at 03:17:11PM +1100, Theo Galanakis used the
keyboard:
> Under postgres 7.3 logging is incredibly slow!
> 
> I have applied the following settings:
> 
> syslog = 2
> syslog_facility = 'LOCAL0'
> syslog_ident = 'postgres'
>  
>  log_connections =  true
> log_duration =  true 
> log_pid =  true 
> log_statement =  true 
> log_timestamp =  true 
>  
> This severely impacted the performance of our production system, a 
> search page which took 1-3 seconds now takes over 30, is this normal?
>  
> I need to get some performance indicators from our production db, 
> however I cant turn on logging with such performance degradation.
>  

Hi Theo,

One thing you should be sure about is that whichever logfile you have
configured for the local0 facility is being written to asynchronously.
Synchronous logging is REALLY expensive.

If you're using the standard syslogd, you can achieve that by prefixing the
filename in syslogd.conf with a dash. For example,

    local0.*		/var/log/postgresql.log

would become

    local0.*		-/var/log/postgresql.log

One other option would be to turn off syslog logging completely and let
postmaster take care of the log on its own, which may or may not be possible
for you, depending on the policy in effect (remote logging, etc.).

Hope this helped,
-- 
    Grega Bremec
    gregab at p0f dot net


______________________________________________________________________
This email, including attachments, is intended only for the addressee
and may be confidential, privileged and subject to copyright.  If you
have received this email in error, please advise the sender and delete
it.  If you are not the intended recipient of this email, you must not
use, copy or disclose its content to anyone.  You must not copy or 
communicate to others content that is confidential or subject to 
copyright, unless you have the consent of the content owner.

Responses

pgsql-performance by date

Next:From: Alexander BorkowskiDate: 2004-12-20 23:09:06
Subject: Re: PG Logging is Slow
Previous:From: sarlav kumarDate: 2004-12-20 22:25:26
Subject: slony replication

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group