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

Re: numerical primary key vs alphanumerical primary key

From: Claudio Freire <klaussfreire(at)gmail(dot)com>
To: Grant Johnson <grant(at)amadensor(dot)com>
Cc: Julien Cigar <jcigar(at)ulb(dot)ac(dot)be>, postgres performance list <pgsql-performance(at)postgresql(dot)org>
Subject: Re: numerical primary key vs alphanumerical primary key
Date: 2013-02-12 16:26:11
Message-ID: CAGTBQpYNO-mLNsWWqPaLUX0B_KSg0aA+=AuUEcN_dDOCHoC5fw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-performance
On Tue, Feb 12, 2013 at 12:05 PM, Grant Johnson <grant(at)amadensor(dot)com> wrote:
> My experience has been that the performance advantage for numeric keys is
> primarily an Oracle thing. However, Oracle is popular enough for people to
> assume that it applies to databases in general.

The advantage in PG also exists, only tied to size. It's not really
whether it's numeric or not, but whether values are big or not. Int or
other primitive types tend to be far faster to join because of their
fixed, small size. If you have a varchar, and if you have big values
from time to time, joining becomes heavy because the index is huge (it
has to contain the values).


In response to

pgsql-performance by date

Next:From: Dan KoganDate: 2013-02-12 17:25:48
Subject: High CPU usage / load average after upgrading to Ubuntu 12.04
Previous:From: Florent GuillaumeDate: 2013-02-12 15:14:15
Subject: Re: numerical primary key vs alphanumerical primary key

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