pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig James <craig_james@emolecules.com>
To: Navkirat Singh <navkirats@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: UUID performance as primary key
Date: Sat, 16 Oct 2010 10:28:41 -0700
Message-ID: <4CB9E0C9.4090702@emolecules.com> (raw)
In-Reply-To: <63CD89CB-22F6-441C-ACBF-F76906B7E468@gmail.com>
References: <63CD89CB-22F6-441C-ACBF-F76906B7E468@gmail.com>

On 10/15/10 6:58 PM, Navkirat Singh wrote:
> I am interested in finding out the pros/cons of using UUID as a
>  primary key field. My requirement states that UUID would be perfect
>  in my case as I will be having many small databases which will link
> up to a global database using the UUID. Hence, the need for a unique
>  key across all databases.

You left out one piece of information: How many keys per second do you need?

We put a sequence in the global database that all secondary databases use to get their IDs.  It means an extra connect/disconnect (a pooler can minimize this), so if you're issuing thousands of IDs per second, this isn't a good idea.  But for a small-ish number of IDs per second, it gets you the benefit of a universal ID without the size of the UUID field.

Craig (the other one)



view thread (5+ messages)  latest in thread

Message-ID: <4CB9E0C9.4090702@emolecules.com>
Permalink:  ../4CB9E0C9.4090702@emolecules.com/
Also on:    postgresql.org/message-id/4CB9E0C9.4090702@emolecules.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: craig_james@emolecules.com, navkirats@gmail.com
  Subject: Re: UUID performance as primary key
  In-Reply-To: <4CB9E0C9.4090702@emolecules.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox