Most of the database designer, programmers or system analyst knows the importance of primary key. It gives the row unique identify so there is no 2 or more rows in the table has the same value in those column.
Some programmers make the primary key only a sequence of number like 1 to maximum number in the PK column using auto increment from the database itself or auto increment from the code. It is good since the database will handle the uniqueness; but it will loose the meaning of the data.
The other reason data will grow fast so the auto increment will loose its functionality.
for example:
PK using integer datatype and auto increment. If the data will grow more than 4 billion records, The programmer or database developer will change to higher datatype like long integer. It is not easy to convert lowest datatype to higher datatype since some RDBMS need recreate the tables and refill again.
PK using string datatype with specific format and length. We can easily predict the data and its growth. With the format of the PK I can easily read the meaning; like 20070112Axx; the record was built on 12 January 2007. It is easy to convert since it is just a string.
Yes, it’s right. RDBMS will create new table and fill it.
But, using string as key is slower than int or long int, when we doing searching using it.
Comment by Ishak — January 14, 2008 @ 7:37 pm