Re: Generating unique session ids

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Tomasz Ostrowski <tometzky(at)batory(dot)org(dot)pl>
Cc: Lexington Luthor <Lexington(dot)Luthor(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Generating unique session ids
Date: 2006-07-27 20:13:02
Message-ID: 20060727201302.GA5478@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jul 27, 2006 at 15:15:32 +0200,
Tomasz Ostrowski <tometzky(at)batory(dot)org(dot)pl> wrote:
>
> * PostgreSQL integers (as returned by nextval()) are 4 bytes. This
> means only 32 bit strength - much too low for today computers.

They are actually 8 bytes. Since session ids aren't valuable for very long
you could actually make a usable system out of this if you rekeyed
frequently.
If the issue is how to cheaply prevent collisions that might occur from
using random session ids, one might consider concatenating a random string
with a sequence. As long as the sequence won't wrap around before a session
id will expire, this will prevent collisions.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2006-07-27 20:29:05 Re: Backslash as ordinary char vs. not; set via a connection/session variable
Previous Message Jasbinder Bali 2006-07-27 19:49:08 server administration problem: Database startup and permissions