Re: Primary Key Performance with INTEGER vs. VARCHAR

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: Siah <siasookhteh(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Primary Key Performance with INTEGER vs. VARCHAR
Date: 2007-07-25 01:35:59
Message-ID: b42b73150707241835t875b88ah8ceb248f243dff0a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/21/07, Siah <siasookhteh(at)gmail(dot)com> wrote:
> Hi,
>
> Designing my application, I was wondering if having my primary keys
> (to be indexed) with VARCHAR brings performance down significantly? My
> own test didn't show much difference. Thinking about it though, I'd
> guess Integer Indexing should be much quicker and efficient.

Integer indexes are usually quicker to build and smaller which
translates to speed (better utilization of o/s cache). The difference
between a index lookup in cache/not in cache is much bigger than index
lookup integer/text. OTOH, text natural keys save you an index you
often have to make anyways and can optimize out joins in some cases.
so the answer is, 'it depends' :-)

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message longlong 2007-07-25 02:53:23 Re: about c# and postgresql
Previous Message Ron Johnson 2007-07-25 01:05:41 Re: Will partial index creation use existing index?