Re: Auto Increment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I would say that generally it's a good thing as it provides a unique key for each record. (I believe one of Codd & Dates's 12 rules for a relational database was that each record had to be uniquely identifiable, or something like that.)

Is it necessary? No, not really, and does impose a minor performance hit.

I generally use auto-incremented primary keys on tables where there are definite parent-child relationships. These keys can be used in the background avoiding any future complications where a client decides to redefine the serial number or similar value often used as primary key. Thus you are pretty-well protected against changes to data fields, whihc means logic isn't broken, etc.

For lookup tables and the like I don't bother with auto-incremented keys.

Regards, and I hope this helps - Miles Thompson

At 11:38 PM 5/9/2003 +0100, shaun wrote:
Hi,

I seem to be putting an auto increment id field in all my tables, is this a
bad thing? If so when should and shouldn't they be used?

Thanks for your help



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux