On May 28, 8:19 am, jrs_66 <jrs...@yahoo.com> wrote: > 250 queries on one page seems to me to be dangerously high. I would > have to guess you could reduce that significantly. Turn on query > output to see if the Django ORM isn't creating sloppy queries in > loops. My guess is that with some code alterations you could help.... >
This seems like a good place to start to me. As far as debugging, there might be some tools on djangosnippets that might help the original poster: http://www.djangosnippets.org/snippets/461/ As somebody else suggested on the thread, I'm not entirely sure about the diagnosis that the template rendering is really the bottleneck, since queries are lazily executed. For debugging purposes, you can force queries to be executed earlier with little impact on the template by turning them into lists, which helps you to more easily identify bottlenecks (but not good for prod, it uses more memory). objs = list(objs) To reduce the sheer number of queries, I recommend experimenting the select_related() feature. I haven't used it in Django, but I've used equivalent features in Rails, and it can lead to pretty drastic speedups, but I'll give the caveat that I was usually trying to reduce delays from latency. Here are docs on select_related(): http://docs.djangoproject.com/en/dev/ref/models/querysets/#id4 Also, as always, it might make good sense to simply divide and conquer, refactor as you go, etc --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---