Thread: Monitoring the sequence cycles

Monitoring the sequence cycles

From
"Marc Mamin"
Date:

Hello,

I'm looking for a way to track the wrap arounds of cycle sequences.

I also couldn't find the view/catalog where sequence definitions are kept;
this could be a good place to store at least the timestamp of the last wrap around.
I'm looking for a way to log all wrap arounds, thought

I guess this is feature request...

best regards,

Marc Mamin

Re: Monitoring the sequence cycles

From
Sam Mason
Date:
On Wed, Aug 19, 2009 at 03:53:29PM +0200, Marc Mamin wrote:
> I'm looking for a way to track the wrap arounds of cycle sequences.

How about disabling cycling and doing your own monitoring?

It seems a bit fiddly because sequence values are created "outside" of
any transaction and hence if you write something into a logging table
you're going to loose it if the transaction rolls back.

--
  Sam  http://samason.me.uk/

Re: Monitoring the sequence cycles

From
"Marc Mamin"
Date:


> How about disabling cycling and doing your own monitoring?

> It seems a bit fiddly because sequence values are created "outside"
> of any transaction and hence if you write something into a logging
> table you're going to loose it if the transaction rolls back.

The sequences are expected to cycle a few times per year, I use them to generate Ids accross large timed tables that are dropped when obsolete.
I want to make sure that I have enough free Ids left...

I will probably implement a "fuzzy" monitoring while logging the current values on a regulary basis.

Thanks,

Marc Mmain




--
  Sam  http://samason.me.uk/

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

Re: Monitoring the sequence cycles

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> I'm looking for a way to track the wrap arounds of cycle sequences.
>
> I also couldn't find the view/catalog where sequence definitions are
> kept; this could be a good place to store at least the timestamp of the
> last wrap around.

You can query: select * from sequence_name;

> I'm looking for a way to log all wrap arounds, thought

I honestly doubt such a feature would be added to the system catalog,
but it certainly might be a nice thing to output to the logs. You might
want to add your request to the wiki so it doesn't get lost:

http://wiki.postgresql.org/wiki/Todo

One thing you can do at the moment is track how close the sequence is
getting near its maxvalue, and thus have an idea of when it is about
to cycle. The check_postgres program can do this for you:

http://bucardo.org/check_postgres/check_postgres.pl.html#sequence

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation
PGP Key: 0x14964AC8 200908201120
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkqNadIACgkQvJuQZxSWSsg9cQCcDm9HzBzBcQL6Yj8rKKoFDtc8
100AnikYzW4quROeThMCsBjfd7aungm2
=5uI0
-----END PGP SIGNATURE-----