Clustered vs NonClustered Primary Key

Elite Mx picture Elite Mx · Jan 26, 2010 · Viewed 19.8k times · Source
begin transaction;
create table person_id(person_id integer primary key);
insert into person_id values(1);
... snip ...
insert into person_id values(50000);
commit;

This code takes about 0.9 seconds on my machine and creates a db file taking up 392K. These numbers become 1.4 seconds and 864K if I change the second line to

create table person_id(person_id integer nonclustered primary key);

Why is this the case?

Answer

Ryan Kirkman picture Ryan Kirkman · Mar 12, 2013

A great answer to this question is available over at the DBA StackExchange: https://dba.stackexchange.com/questions/7741/when-should-a-primary-key-be-declared-non-clustered/7744#7744