Thanks.
Now, I will use PositiveSmallIntegerField
I don't need a whole PositiveIntegerField (1900-->2100) and I want to
compare years

Thanks a lot,
Xan.

PS: Greg, yes there are lot of documentation, but it's more technical.
Web site of django offers a good tutorial, good for "anybody". Rails
offers information for gurus or developers at least.


On Sep 9, 9:22 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > Well, secondly I have one question: I have a model A that have a field
> > "year" that means the year that A was made. I just want to know if
> > it's best (for performance) to code as:
>
> > class A(models.Model):
> >      year = models.CharField(maxlength=4)
> > [...]
>
> > or
> > class A(models.Model):
> >      year = models.PossitiveIntegerField()
> > [...]
>
> > what it's the best for database performance (I use mysql)
>
> I don't think has considerable performances reasons to choose one
> over the other.  However, for sorting and validation purposes,
> you might want to go with the PositiveIntegerField (one "s" in
> "Positive").
>
> For sorting purposes, an integer field may be a tiny portion
> faster than the char field.
>
> You might even slap on some validators if your years don't extend
> too far back.  It's one thing if you're using years for dating
> early Judeo-Christian literature, where you might have valid
> years such as "214".  However, if all your years are recent-ish,
> you can toss a validator on your field to ensure, say, that the
> value is since 1900 or some other such limitation.
>
> I would lean towards validated PositiveIntegerField fields.
>
> -tim


--~--~---------~--~----~------------~-------~--~----~
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