I don't know about lookup speeds, but I believe the storage
requirement would be smaller if you go with a numeric data type over
characters:

To represent all 13-digit unsigned integers, you need 47 bits (2^47 =
1.4 * 10^14).

To represent a 13-character string (that may be composed of digits),
you need at least 104 bits (8 bytes * 13). You might need more than
one byte per character depending on your character encoding.

So it looks to me like storing numbers in numeric format requires
about half the space as character format in this case.  Of course, you
can't store just 47 bits exactly in MySQL; you'll probably spend 64
bits of storage space (seems like the next logical boundary, haven't
checked the docs for specifics though).  But even so, it cheaper than
storing numbers as characters.

And of course, this is probably a trivial matter unless you have huge
amounts of numbers to store.



On Sep 2, 1:00 pm, coan <[EMAIL PROTECTED]> wrote:
> For now I was planning to store ISBN13 and 13 digit ean codes.
>
> In mysql a bigint field would hold these, but I see no corresponing
> fieldtypes in django for bigints -
> the positiveintegerfield sets itself up as an int(10) signed field
> type in mysql. -
> I guess I could store them as charfields, but I think lookups go
> faster in a bigintfield.
>
> On Sep 2, 9:50 pm, tchendrix <[EMAIL PROTECTED]> wrote:
>
> > the reason i'm asking is that digits 14 and 15 will be alphanumeric so
> > add another field or two for that data (char?) and use bigint to hold
> > the numerical data
>
> > coan wrote:
> > > On Sep 2, 9:36 pm, tchendrix <[EMAIL PROTECTED]> wrote:
>
> > >> that looks like it's for an EAN code... how are you planning on EAN14
> > >> and EAN 15?
>
> > > I will take them on one digit at a time :-)
> > > First I have to solve my 13 digit problem.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to