Another tool that is less robust but easier than django-debug-toolbar to simply drop into your code is import django.db.connection as conn followed by putting print(conn.queries) or print(len(conn.queries)) before and after where you suspect large numbers of repeated queries are being executed.
(See also: http://stackoverflow.com/questions/2133627/using-django-db-connection-queries ) On Sunday, January 4, 2015, Andrew Farrell <armorsmit...@gmail.com> wrote: > To clarify: I'm not a django core dev and by "neglect" I don't mean that > anyone is being neglectful, just focusing efforts elsewhere. > > On Sunday, January 4, 2015, Andrew Farrell <armorsmit...@gmail.com > <javascript:_e(%7B%7D,'cvml','armorsmit...@gmail.com');>> wrote: > >> The django development server is slow by intentional neglect; It isn't >> supposed to be used in production because the django team does not want to >> divide its focus by supporting a full-fledged web server that is >> performance-optimized and security-audited. They want to include a >> development server that can be used by someone who wants to go from >> 0-to-understanding-and-building with django without first having to install >> a production server like gunicorn >> <http://gunicorn-docs.readthedocs.org/en/latest/deploy.html>. >> >> A few useful tools for improving your performance are select-related >> <https://docs.djangoproject.com/en/1.7/ref/models/querysets/#select-related> >> , prefetch-related >> <https://docs.djangoproject.com/en/1.7/ref/models/querysets/#django.db.models.query.QuerySet.prefetch_related>, >> and Django-debug-toolbar >> <https://django-debug-toolbar.readthedocs.org/en/1.2.2/>. >> They can help you reduce the number of queries you are making. >> >> On Sun, Jan 4, 2015 at 10:41 PM, Richard Brockie < >> richard.broc...@gmail.com> wrote: >> >>> Hello again, >>> >>> I'm to the point in my django development that I am beginning to use >>> realistic amounts of test data. I'm using postgresql as the database >>> server, with PyCharm as my IDE, everything in a virtualenv on an SSD on an >>> Ivy Bridge Core i7 processor with 16 GB of RAM running Windows 7 64-bit. >>> >>> One disappointing thing I have just encountered is the lack of speed >>> when working with my real-world data. I'm comparing this with the same data >>> in a non-framework-based php/MySQL webapp running on XAMPP (which means >>> apache) in parallel on the same system. >>> >>> With DjDT installed (Django development tools), I'm getting the >>> following stats: >>> >>> - Quick to load page:SQL: 5 queries in 4 ms, Time: 76 ms >>> - Slow to load page: SQL: 1189 queries in 463 ms, Time: 9754 ms >>> >>> From task manager, the slow to load page is making "python.exe *32" use >>> 1 whole logical processor during the page load. >>> >>> Are these expected response times? I'm hoping this is the result of a >>> non-optimized development server, and not the expected performance of >>> Django itself. >>> >>> Any comments or advice? >>> >>> Thanks, >>> R. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-users+unsubscr...@googlegroups.com. >>> To post to this group, send email to django-users@googlegroups.com. >>> Visit this group at http://groups.google.com/group/django-users. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/9c8f3393-78b1-4d9f-a78d-954b957ebdfa%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/9c8f3393-78b1-4d9f-a78d-954b957ebdfa%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2By5TLZYNA8T-L61N%2BHaC9wo5mJFu1kgKoobQ9VbWrGJyC%3DMow%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.