How Many PG_Locks are considered too many

Started by Renato Oliveiraover 10 years ago6 messagesgeneral
Jump to latest
#1Renato Oliveira
Renato.Oliveira@cantabcapital.com

Hi

I have few questions, if anyone could help me, it will be very much appreciated.

We have a Nagios plugin, which monitors pg_locks and almost daily we see 3000 to 40000 pg_locks.

Can we just ignore them, can we let them grow without worrying?
How many pg_locks are considered unsafe for any given postgres server?

Thank you

Renato

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Renato Oliveira (#1)
Re: How Many PG_Locks are considered too many

On 7/30/15 6:13 AM, Renato Oliveira wrote:

We have a Nagios plugin, which monitors pg_locks and almost daily we see
3000 to 40000 pg_locks.

Can we just ignore them, can we let them grow without worrying?

How many pg_locks are considered unsafe for any given postgres server?

That depends on how many concurrent clients you have and what they are
doing. Every table access will at least create a share lock of some
kind, so if you have a lot of activity that does a lot of things, you
will see a lot of locks, but that doesn't impact database performance in
a significant way.

I don't think monitoring the absolute number of locks is useful. You
might want to chart it, to compare over time. If you want to monitor
locks, you could monitor lock waits, which you can get by checking the
server log.

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

#3Renato Oliveira
Renato.Oliveira@cantabcapital.com
In reply to: Peter Eisentraut (#2)
Re: How Many PG_Locks are considered too many

Peter thank you much appreciated

Sent from my iPhone

On 30 Jul 2015, at 14:54, Peter Eisentraut <peter_e@gmx.net> wrote:

On 7/30/15 6:13 AM, Renato Oliveira wrote:
We have a Nagios plugin, which monitors pg_locks and almost daily we see
3000 to 40000 pg_locks.

Can we just ignore them, can we let them grow without worrying?

How many pg_locks are considered unsafe for any given postgres server?

That depends on how many concurrent clients you have and what they are
doing. Every table access will at least create a share lock of some
kind, so if you have a lot of activity that does a lot of things, you
will see a lot of locks, but that doesn't impact database performance in
a significant way.

I don't think monitoring the absolute number of locks is useful. You
might want to chart it, to compare over time. If you want to monitor
locks, you could monitor lock waits, which you can get by checking the
server log.

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

#4John Scalia
jayknowsunix@gmail.com
In reply to: Renato Oliveira (#3)
Re: [ADMIN] How Many PG_Locks are considered too many

Seconding Peter on this one; it's a lot more important should one of those
locks be hanging around, say for hours or days, not how many have come and
gone.
--
Jay

On Thu, Jul 30, 2015 at 8:57 AM, Renato Oliveira <
Renato.Oliveira@cantabcapital.com> wrote:

Show quoted text

Peter thank you much appreciated

Sent from my iPhone

On 30 Jul 2015, at 14:54, Peter Eisentraut <peter_e@gmx.net> wrote:

On 7/30/15 6:13 AM, Renato Oliveira wrote:
We have a Nagios plugin, which monitors pg_locks and almost daily we see
3000 to 40000 pg_locks.

Can we just ignore them, can we let them grow without worrying?

How many pg_locks are considered unsafe for any given postgres server?

That depends on how many concurrent clients you have and what they are
doing. Every table access will at least create a share lock of some
kind, so if you have a lot of activity that does a lot of things, you
will see a lot of locks, but that doesn't impact database performance in
a significant way.

I don't think monitoring the absolute number of locks is useful. You
might want to chart it, to compare over time. If you want to monitor
locks, you could monitor lock waits, which you can get by checking the
server log.

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

#5Merlin Moncure
mmoncure@gmail.com
In reply to: John Scalia (#4)
Re: [GENERAL] How Many PG_Locks are considered too many

On Thu, Jul 30, 2015 at 9:19 AM, John Scalia <jayknowsunix@gmail.com> wrote:

Seconding Peter on this one; it's a lot more important should one of those
locks be hanging around, say for hours or days, not how many have come and
gone.

Also, it's good to focus on *ungranted* locks. Typically the only
time I care about granted locks is to find out which process is
keeping my other process getting its lock granted.

merlin

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

#6Renato Oliveira
Renato.Oliveira@cantabcapital.com
In reply to: Merlin Moncure (#5)
Re: [GENERAL] How Many PG_Locks are considered too many

Thank you appreciated

Sent from my iPhone

On 30 Jul 2015, at 20:05, Merlin Moncure <mmoncure@gmail.com> wrote:

On Thu, Jul 30, 2015 at 9:19 AM, John Scalia <jayknowsunix@gmail.com> wrote:
Seconding Peter on this one; it's a lot more important should one of those
locks be hanging around, say for hours or days, not how many have come and
gone.

Also, it's good to focus on *ungranted* locks. Typically the only
time I care about granted locks is to find out which process is
keeping my other process getting its lock granted.

merlin

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin