maexus Posted February 11, 2008 Share Posted February 11, 2008 I'm creating a small database because I need to store two fields. A hash and a timestamp. I don't see a need for an autoinc'd ID field. Is it required or am I missing a reason that I need one? Quote Link to comment https://forums.phpfreaks.com/topic/90420-autoincd-id-required/ Share on other sites More sharing options...
roopurt18 Posted February 11, 2008 Share Posted February 11, 2008 No it's not required. But if the records in this table are going to be linked anywhere else then it can make joins faster AFAIK. Quote Link to comment https://forums.phpfreaks.com/topic/90420-autoincd-id-required/#findComment-463838 Share on other sites More sharing options...
aschk Posted February 11, 2008 Share Posted February 11, 2008 Assuming the following: 1) Either you hash or timestamp is unique Then there's no reason why you can't use both or either of those as your PRIMARY KEY. I'm not 100% on this but I believe AUTO_INCREMENT ids DON'T make JOINs any faster than any other PRIMARY KEY. Quote Link to comment https://forums.phpfreaks.com/topic/90420-autoincd-id-required/#findComment-463861 Share on other sites More sharing options...
maexus Posted February 11, 2008 Author Share Posted February 11, 2008 Didn't think I needed one but didn't want to go through all that and then had to go back and fix. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/90420-autoincd-id-required/#findComment-463977 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.