Re: How to log 'user time' in postgres logs

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: francis picabia <fpicabia(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to log 'user time' in postgres logs
Date: 2019-08-29 22:29:51
Message-ID: 3bdfc324-c1fe-6ac6-1584-0e21ad4891e9@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/28/19 11:36 AM, francis picabia wrote:
>

>
> The other possibility was it just didn't log the slower times, but I
> have seen larger numbers
> in the 10,000 ms range in the night when some backups and housekeeping
> happens.
>
> All  log related settings:
> checkpoint_segments = 12
> logging_collector = on
> log_destination = 'stderr'
> log_directory = 'pg_log'
> log_filename = 'postgresql-%a.log'
> log_truncate_on_rotation = on
> log_rotation_age = 1440
> log_rotation_size = 0
> log_min_messages = info
> log_min_error_statement = debug1
> log_duration = on
> log_line_prefix = '<%t>'

You might also want to log:

log_connections = on

log_disconnections = on

And add to log_line_prefix some mix of:

%u User name

%p Process ID

%s Process start time stamp

>
> I know it does sound strange, but this is what we battled with for 2.5
> days until the light
> came on that the vacuum had been set to off on the target system during
> server migration.
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ken Tanzer 2019-08-30 00:42:24 Exclusion constraints on overlapping text arrays?
Previous Message Peter Grman 2019-08-29 20:54:04 Bad Estimate for multi tenant database queries