pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robins Tharakan <tharakan@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Varchar pkey instead of integer
Date: Wed, 21 May 2008 11:10:43 +0530
Message-ID: <36af4bed0805202240v5fbdd6bcv75643a6488cd1daf@mail.gmail.com> (raw)

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*

view thread (7+ messages)  latest in thread

Message-ID: <36af4bed0805202240v5fbdd6bcv75643a6488cd1daf@mail.gmail.com>
Permalink:  ../36af4bed0805202240v5fbdd6bcv75643a6488cd1daf@mail.gmail.com/
Also on:    postgresql.org/message-id/36af4bed0805202240v5fbdd6bcv75643a6488cd1daf@mail.gmail.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: tharakan@gmail.com
  Subject: Re: Varchar pkey instead of integer
  In-Reply-To: <36af4bed0805202240v5fbdd6bcv75643a6488cd1daf@mail.gmail.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