Jump to content

integer or text ?


manix

Recommended Posts

Hey,

 

 

I have this brainstorm whether I should store id's as integers or text? I mean in my database, since my IDs start from like 1319129364 which is a rather large number, I was thinking if it would be better to save it as text? Which case requires less memory ?

Link to comment
Share on other sites

Integers.

 

ASCII is 8 bits per character. Each time you add a bit to an integer, the maximum size double.

 

String '1319129364' = 80 bits.

Integer 1319129364 = 31 bits.

 

Keep in mind, the largest signed integer is ~2^31

The largest unsigned integer (no negatives) is ~2^32

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.