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;
此代碼在我的機器上大約需要0.9秒,並創建一個佔用392K的db文件。這些數字成爲約1.4秒864K,如果我改變第二行Clustered vs NonClustered主鍵
create table person_id(person_id integer nonclustered primary key);
爲什麼會出現這種情況?
如果我沒做連接,也不範圍掃描計劃,只關心插入性能 - 會不會有什麼更好的方式來創建表比第一個例子? – 2010-01-26 09:56:23
如果您只關心插入性能,則根本不應使用索引(如果支持),或將數據寫入文本文件。附加到文本文件非常快。 – MarkR 2010-01-26 21:49:35