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

Re: Do non-sequential primary keys slow performance significantly??

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Damian C" <jamianb(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Do non-sequential primary keys slow performance significantly??
Date: 2006-09-29 05:49:05
Message-ID: 10481.1159508945@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-novice
"Damian C" <jamianb(at)gmail(dot)com> writes:
> In my ignorant bliss I would suspect that postgres will run more
> slowly using random primary keys.

More slowly compared to what?

If your performance bottleneck is concurrent insertions, random keys
should win over sequential keys because the insert load is distributed
over the whole index, leading to less page-level lock contention.
There might be other scenarios where sequential keys are better.

For a database servicing "only a few PCs" I'm not sure you should even
spend any time thinking about it --- do what's easiest for your
application code.

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Ray StellDate: 2006-09-29 13:35:34
Subject: Re: tablespace?
Previous:From: Damian CDate: 2006-09-29 05:29:18
Subject: Do non-sequential primary keys slow performance significantly??

pgsql-general by date

Next:From: snacktimeDate: 2006-09-29 05:59:00
Subject: using schema's for data separation
Previous:From: Bo LorentsenDate: 2006-09-29 05:48:41
Subject: Re: Replication and PITR

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