Re: 64-bit sequences

From: Paul Caskey <paul(at)nmxs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 64-bit sequences
Date: 2000-07-03 23:11:43
Message-ID: 39611DAF.C962475B@nmxs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
>
> Paul Caskey <paul(at)nmxs(dot)com> writes:
> > Okay, cool. Similar subject: What about making the oid 64-bit?
>
> Let's just say you'd be opening a *much* larger can of worms there,
> because Oid is used all over the place whereas only a few routines
> know anything about sequences.

Aha! Thanks for the warning.

> This is (or should be) on the TODO list but I wouldn't recommend it
> as your first backend programming project.
>
> > At first glance, this seems easier to change than the sequence
> > generator, since you guys do a good job of using sizeof() and the Oid
> > typedef.
>
> Except for all the places that assume Oid is interchangeable with int.
> Finding them is left as an exercise for the student...

Again, thanks for the warning. :-)

Thanks for the comments on this thread. It sounds too tricky for me to
attempt any type of 64-bit sequence at this time, especially on a 32-bit
platform. For now, I've made my critical "id" variables type INT8, but
still use an INT4 sequence to increment them. If/when an INT8 sequence
becomes available in the future, I will drop one in. Otherwise if I start
getting close to the 2GB limit, I'll find a workaround to reuse holes in
the sequence.

There doesn't seem to be any problem using pgsql's int4-->int8 automatic
conversion in this way. Hopefully I can also join on int4/int8 values
without any snags or big performance problems, although I haven't tested
that.

--
Paul Caskey paul(at)nmxs(dot)com Software Engineer
New Mexico Software 5041 Indian School NE Albuquerque, NM 87110
--

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-07-03 23:23:51 Re: [COMMITTERS] TOAST
Previous Message Jan Wieck 2000-07-03 23:09:56 pgsql/src/backend/utils/adt (arrayfuncs.c cash.c char.c float.c formatting.c int.c int8.c lztext.c mac.c nabstime.c network.c oid.c oracle_compat.c pg_lzcompress.c regproc.c ruleutils.c timestamp.c varbit.c varchar.c varlena.c version.c)