Varchar pkey instead of integer

From: "Robins Tharakan" <tharakan(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Varchar pkey instead of integer
Date: 2008-05-21 05:40:43
Message-ID: 36af4bed0805202240v5fbdd6bcv75643a6488cd1daf@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

I am currently designing a database and wanted to know something that may
sound trivial, but I thought its still good to confirm before dumping
millions of rows in it.

The design requires a few master tables with very limited rows, for e.g.
currency_denomination table could at the max have a few records like million
/ billion / crore (used in india) / lacs (india specific) and so on.

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 ?

p.s.: I am not as much concerned with the size that it'd take on the data
tables, as much as the fact that the select / insert performances shouldn't
suffer. However, if that increase in size (per data record) may make a
considerable impact on the performance, I would certainly want to take that
into account during design phase.

Any pointers / replies appreciated.

Regards,
*Robins Tharakan*

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Joshua D. Drake 2008-05-21 06:16:34 Re: Varchar pkey instead of integer
Previous Message PFC 2008-05-20 20:54:23 Re: improving performance for a delete