Re: Server stops responding in every week

From: "Andrus Moor" <kobruleht2(at)hot(dot)ee>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: "Andy Colson" <andy(at)squeakycode(dot)net>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Server stops responding in every week
Date: 2011-01-23 10:38:49
Message-ID: 20C0C2B900B84131890E8018EC64D06F@server
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Scott,

Thank you.

>I know you're running windows, but if you can get bash working on it,
> here's a simple bash script I wrote that when it detects too many
> people connected creates a table called pg_stat_bk_20110120140634
> (i.e. date and time) so I can then look over what was in
> pg_stat_activity when things were acting up.

I can run scripts from windows scheduler for every 4 minutes or maybe from
pgadmin or maybe frequently accessed table triggers.

Whan command should be used to detect presence of hangup ( maybe query
running more than 60
seconds or too many idle transactions?)
should pg_stat_activity.query_start column used for this ?

How to log memory usage ?

Is it best way to use initially:

create table activity as select * from pg_stat_activity limit 0;
create table locks as select * from pg_locks limit 0;

and if script detects hangup it invokes

insert into activity select * from pg_stat_activity;
insert into locks select * from pg_locks;

How to add log timestamp column to activity and locks tables ?
How to log memory usage ?
Can users notice server perfomance degration due to this?
What else to log ?
How to create plpgsql procedure for this ?

There are few tables which are used frequently. Hangup occurs probably if
queries are invoked againt those tables.
Is it better to implement this as trigger for those tables?

Andrus.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Attila Nagy 2011-01-23 11:29:08 Postgresql as a dictionary coder backend?
Previous Message Sim Zacks 2011-01-23 09:40:03 Re: Subquery for column names of tablefunc crosstab queries