On Sun, Aug 24, 2008 at 1:23 AM, Juan Hernandez <[EMAIL PROTECTED]>wrote:

>
> So, let's say that everytime i get a page, the internat query to the db
> just gets the, lets say, 10 rows that I requested? because I'm using
> objects.all(). In that process, where is the DB being hit?
>
>
Model.objects.all() is a QuerySet, which is lazy:
http://www.djangoproject.com/documentation/db-api/#querysets-are-lazy.  The
Paginator will further limit the QuerySet before doing anything that causes
the QuerySet to be evaluated (causing a read from the database).  The
Paginator may call count() on the QuerySet to read the total number of items
from the DB (I'd have to look at the implementaiton, and it could depend on
how you use it), but the actual reading of the data from the table won't
happen until your code calls the paginator to retrieve the data in a page.

Karen

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