2

I want to profile my project to figure out what indices to create in db. I've installed django-debug-toolbar. The problem is that it is extremely slowing down page loading.

Moreover, couple minutes ago it was showing about 80 000 queries, now it takes about 48 seconds and it says that there are 2300 queries (which is according to Django Querycount correct). But when I turn django-debug-toolbar off, it works correctly (about 3 or 4 seconds).

Do you know what could cause problem? I've found that this was bug, but it was a couple years ago.

enter image description here

Ilya Luzyanin
  • 7,910
  • 4
  • 29
  • 49
Milano
  • 18,048
  • 37
  • 153
  • 353
  • 1
    Did you consult official [documentation](https://django-debug-toolbar.readthedocs.io/en/stable/tips.html) there is a good tip for solving this problem – copser Dec 21 '16 at 19:07
  • What tip do you mean? I've noticed that turning sql panel off helpes dramatically but it's what I need to see to know what indices do I have to create or what queries do I have to optimize. – Milano Dec 21 '16 at 19:16
  • Try with [caching template loader](https://docs.djangoproject.com/en/1.10/ref/templates/api/#django.template.loaders.cached.Loader), here is a similar [problem](http://stackoverflow.com/a/9182798/4107823), read the part about cached loader – copser Dec 21 '16 at 19:41
  • 1
    well if your page has 2300 queries you have to expect DDT to spend a bit of time processing that. The obvious thing is to use select_related and prefetch_related to cut down the number of queries – e4c5 Dec 23 '16 at 10:15

0 Answers0