Skip site navigation (1) Skip section navigation (2)

Re: Varchar pkey instead of integer

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Robins Tharakan <tharakan(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Varchar pkey instead of integer
Date: 2008-05-21 06:16:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Robins Tharakan wrote:
> Hi,

> Now what I wanted to ask was whether its any different to have the 
> primary-keys in such master tables as text/varchar rather than integer ? 
> i.e. Can I use a character varying(10) and use the text 'million' / 
> 'billion' instead of a serial / integer type ?

One should ask themselves why before can I. :)

If you want to use a varchar() for a primary key that is fine but make 
it a natural key not an arbitrary number. If you are going to use 
arbitrary numbers, use a serial or bigserial.

Joshua D. Drake

In response to

pgsql-performance by date

Next:From: Craig RingerDate: 2008-05-21 06:34:45
Subject: Re: Varchar pkey instead of integer
Previous:From: Robins TharakanDate: 2008-05-21 05:40:43
Subject: Varchar pkey instead of integer

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group