Re: Do non-sequential primary keys slow performance significantly?? - Mailing list pgsql-novice

From Tom Lane
Subject Re: Do non-sequential primary keys slow performance significantly??
Date
Msg-id 10481.1159508945@sss.pgh.pa.us
Whole thread Raw
In response to Do non-sequential primary keys slow performance significantly??  ("Damian C" <jamianb@gmail.com>)
List pgsql-novice
"Damian C" <jamianb@gmail.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

pgsql-novice by date:

Previous
From: "Damian C"
Date:
Subject: Do non-sequential primary keys slow performance significantly??
Next
From: Ray Stell
Date:
Subject: Re: tablespace?