jeremyhowell Posted December 10, 2009 Share Posted December 10, 2009 I need to save as much space in my database as possible, and I will be storing Facebook IDs in a table, which are very long, and I was wondering whether I would save more space converting the numbers to HEX and storing them in a VARCHAR, or just saving them in an INT field. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/184594-using-int-or-varchar-to-store-numbers-or-convert-to-hex/ Share on other sites More sharing options...
ngreenwood6 Posted December 10, 2009 Share Posted December 10, 2009 I dont think that it is really necessary to save them as hex. If you were to convert them to hex it would take extra time to run, then when you needed to query it back you would have to decrypt it (taking extra time) and its not really going to take up that much space in the database. You could however always store them as a varchar if you choose though. Quote Link to comment https://forums.phpfreaks.com/topic/184594-using-int-or-varchar-to-store-numbers-or-convert-to-hex/#findComment-974485 Share on other sites More sharing options...
jeremyhowell Posted December 10, 2009 Author Share Posted December 10, 2009 So what takes up less space on a database, INT or VARCHAR? Quote Link to comment https://forums.phpfreaks.com/topic/184594-using-int-or-varchar-to-store-numbers-or-convert-to-hex/#findComment-974511 Share on other sites More sharing options...
premiso Posted December 10, 2009 Share Posted December 10, 2009 I would store it as an integer just because that is what it is and it generally is a good idea to store data as the type that they are. But there are always exceptions to the rules. A good read that may help you decide: http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html Check out that. Quote Link to comment https://forums.phpfreaks.com/topic/184594-using-int-or-varchar-to-store-numbers-or-convert-to-hex/#findComment-974542 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.