Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 primary key datatype issue

Author  Topic 

kakusei
Starting Member

1 Post

Posted - 2005-07-01 : 05:56:14
Hi All,

i want to know what would be the best datatype or format to use as a primary key for a very large user's table say expecting to be around 1,000,000 records or more? would an identity field be a good choice or a CHAR field of 8-10 random numbers be better? if indentity field is the choice then what is the best seed to start with? if a CHAR field is better then how should i generate the random numbers? and would 8-10 random numbers be enough for that much records and more?? OR is there other ways to generate the primary keys for that much records? And also i want to know what format of a primary key would give the best performance eg. a series sequential numbers like 1000001,1000002,100003, etc... or some random numbers?

regards

hgorijal
Constraint Violating Yak Guru

277 Posts

Posted - 2005-07-01 : 07:01:56
I'm not sure if this is question on what data type to use or what kind of format to use...
Anyways...IMHO,

CHAR is a bad choice.
INT is a good choice.

Random numbers is a bad choice.
Sequential number is a good choice.

IDENTITY : GOOD choice to keep things simple and if you don't care about missing keys caused by deleting records. INT IDENTITY(1,1) can store much more than 1,000,000 records.

What seed to use? : Your preference. Higher the SEED and INCREMENT, lesser the number of records you can store. Doesn't really effect performance.


Hemanth Gorijala
I Came. I Saw. I Normalized.
Go to Top of Page
   

- Advertisement -