Bigger sequences (int8)

From: Paul Caskey <paul(at)nmxs(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Bigger sequences (int8)
Date: 2000-06-16 20:01:10
Message-ID: 394A8786.F0A74BAF@nmxs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Can I make a sequence use an int8 instead of int4?

I have an application where, over a few years, it's quite possible to hit
the ~2 billion limit. (~4 billion if I start the sequence at -2
billion.)

There won't be that many records in the table, but there will be that many
inserts. In other words, there will be many deletes, as well.

If I CYCLE, old record could still be lingering, and I have the overhead
of checking every NEXTVAL to make sure it's not already being used. :-(

Any other ideas? I could use two int4's together as primary key, and do
some crazy math to increment, or jump through other hoops (besides CYCLE)
to intelligently reuse keys ... but then I have some ugly overhead, as
well.

I really want the sequence to just be an int8. Are we talking about a
heinous amount of work in the source code to allow this option? I
wouldn't want to mess with the "CREATE SEQUENCE" syntax; it would seem
more appropriate as a compile-time option.

Paul Caskey
Software Engineer
New Mexico Software

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Giles Lean 2000-06-16 23:25:22 Re: postmaster logs
Previous Message Tyler Robert Wood 2000-06-16 19:57:13 copying table to a file