count() does a sql count statement, while len() loads all rows from
the database and returns the array length of the results.
count() is much faster and better to use if you can conditionally
avoid loading all results.

On Jun 15, 6:17 am, Lee Hinde <[email protected]> wrote:
> This started off as a pagination question, but then I realized it was
> a different issue:
>
> Given:http://dpaste.com/hold/207217/
>
> why would  len(n)  be different  than n.count()
>
> In my case, the len result is correct, but Paginator tries count first
> (and uses that value).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
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