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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-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

Browse pgsql-general by date

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

Browse pgsql-novice by date

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