Re: Using a single sequence for all tables

From: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Using a single sequence for all tables
Date: 2021-09-29 09:55:19
Message-ID: YVQ4B8o7lDW1fi8K@hjp.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2021-09-29 11:42:42 +0200, Tobias Meyer wrote:
> Possible drawbacks:
>
>  * The ids will grow faster, and they will be large even on small
>    tables. It may be a bit irritating if you have a table with just 5
>    rows and the ids are 5, 6, 7, 12654, 345953.
[...]
>
> * you will have to pay attention to rollover/overflow situations more quickly. 

I'd subsume this under "ids will grow faster".

But I would actually see that as an advantage:

* All your ids have the same type, so either 32 bit is enough for
everything or you use 64 bit (do the latter if in doubt).
* You only have to monitor a single sequence to see if you are close to
an overflow, not dozens of them.
* You will probably be more aware that this might be a problem.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2021-09-29 10:18:47 Re: Using a single sequence for all tables
Previous Message Tobias Meyer 2021-09-29 09:42:42 Re: Using a single sequence for all tables