pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jean-Michel POURE <jm.poure@freesurf.fr>
To: postgres@vrane.com
To: alanjwayne@yahoo.com
Cc: pgsql-general@postgresql.org
Subject: Re: HOWTO - Random character generation for primary key
Date: Thu, 2 May 2002 11:58:53 +0200
Message-ID: <200205021158.53937.jm.poure@freesurf.fr> (raw)
In-Reply-To: <20020502053002.A4681@amd.universe>
References: <20020502020148.35486.qmail@web21203.mail.yahoo.com>
	<200205021104.06992.jm.poure@freesurf.fr>
	<20020502053002.A4681@amd.universe>

Le Jeudi 2 Mai 2002 11:30, postgres@vrane.com a écrit :
> Untrue.  I am using email addresses
> as primary keys in a table.  Where
> did you get that information?

Sorry, I did not mean that of course. I posted this small howto in reply to a 
mail. It shows how to create a VACHAR PRIMARY KEY with unique random values.

On 10 character lenght, there is approximatively one chance out of 26^10 to 
have a similar value. If you add a string timestamp, like "20020501_1153_" in 
front of the random value, it is very likely that this value will be UNIQUE 
in the word:

Examples:
- 20020501_1153_AHFYRIDKRN
- 20020501_1154_JDIFTPWNEJ

I would like to write a small HOWTOs about :
- Software optimization and performance (not pseudo-hardware / memory /  
etc..),
- PLpgSQL and PLpython. 

Therefore, I try to send small HOWTOs on the list whenever I can answer 
someone. Any help welcome.

Best regards,
Jean-Michel POURE



view thread (5+ messages)  latest in thread

Message-ID: <200205021158.53937.jm.poure@freesurf.fr>
Permalink:  ../200205021158.53937.jm.poure@freesurf.fr/
Also on:    postgresql.org/message-id/200205021158.53937.jm.poure@freesurf.fr

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: jm.poure@freesurf.fr, postgres@vrane.com, alanjwayne@yahoo.com, pgsql-general@postgresql.org
  Subject: Re: HOWTO - Random character generation for primary key
  In-Reply-To: <200205021158.53937.jm.poure@freesurf.fr>
  References: <20020502020148.35486.qmail@web21203.mail.yahoo.com> <200205021104.06992.jm.poure@freesurf.fr> <20020502053002.A4681@amd.universe> <200205021158.53937.jm.poure@freesurf.fr>

* 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