On Fri, Jun 17, 2011 at 10:39 AM, David Johnston <polobo@yahoo.com> wrote:
> Tangential comment but have you considered emitting a warning (and/or log
> entry) when you are 10,000-50,000 away from issuing the last available
> number in the sequence so that some recognition exists that any code
> depending on the sequence is going to fail soon?
>
> Also, during sequence creation you know the integer type being used so that
> maximum value is known and an overflow should not need to come into play (I
> guess the trade-off is the implicit "try-catch" [or whatever mechanism C
> uses] performance hit versus the need to store another full integer in the
> data structure).
>
> You could also give access to the "warning threshold" value so that the
> developer can change it to whatever value is desired (with a meaningful
> default of course).
There are already tools out there that can monitor this stuff - for
example, check_postgres.pl.
http://bucardo.org/check_postgres/check_postgres.pl.html#sequence
We tend to avoid emitting warnings for this kind of thing because they
can consume vast amounts of disk space, and a lot of times no one's
looking at them anyway.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company