Re: Using PK value as a String

From: Mathias Stjernström <mathias(at)globalinn(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Using PK value as a String
Date: 2008-08-12 13:57:09
Message-ID: 0673579A-B049-4619-B6E4-EE427FB0DDBA@globalinn.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi!

We use normal sequences to generate id's across multiple nodes. We
use the "increment" parameter for the sequence and we specify each
node to increment its sequence with for example 10 and the the first
node to start the sequence at 1 and the second at 2 and so on. In that
way you get an unique ID across each nodes thats an INT. Not in
chronological order but it's unique ;)

The only issue with this is that the value you chose for increment
value is your node limit.

Cheers!

Mathias

On 12 aug 2008, at 14.51, Gregory Stark wrote:

> "Mario Weilguni" <mweilguni(at)sime(dot)com> writes:
>
>> UUID is already a surrogate key not a natural key, in no aspect
>> better than a
>> numeric key, just taking a lot more space.
>>
>> So why not use int4/int8?
>
> The main reason to use UUID instead of sequences is if you want to
> be able to
> generate unique values across multiple systems. So, for example, if
> you want
> to be able to send these userids to another system which is taking
> registrations from lots of places. Of course that only works if that
> other
> system is already using UUIDs and you're all using good generators.
>
> You only need int8 if you might someday have more than 2 *billion*
> users...
> Probably not an urgent issue.
>
> --
> Gregory Stark
> EnterpriseDB http://www.enterprisedb.com
> Ask me about EnterpriseDB's Slony Replication support!
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org
> )
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Mark Mielke 2008-08-12 14:11:50 Re: Using PK value as a String
Previous Message Gregory Stark 2008-08-12 13:46:57 Re: Using PK value as a String