On 7/2/07, jj <[EMAIL PROTECTED]> wrote:
> > How many HTTP requests?
>
> It's only me testing at the moment, and it's already slow enough.


Sorry, I meant how many HTTP requests *per page*, as in, how many
external resource references?

Are you serving media off a separate server, or though apache?  If
apache, are you using it's regular file service or running it through
Django?

> 1, essentially: Book.objects.select_related(). Plus access to 5
> foreign objects per book.

with settings.DEBUG = True:

from django.db import connection
print connection.queries

May give you a clue.

>     book_list = cache.get('all_books')
>     if not book_list:
>         book_list = Book.objects.select_related()
>         cache.set('all_books', book_list)

This doesn't actually cache the result set.  Querysets are lazy.
If you want to cache the finished results, try this:

     book_list = cache.get('all_books')
     if not book_list:
         book_list = list(Book.objects.select_related())
         cache.set('all_books', book_list)

>     book_list = [b for b in book_list if b.is_visible_by(user)]

     Concur with Tim that this may be worth making a DB function and
using extra() on.

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