#27269: ORM extremely slow to run annotate/filter query, much faster directly in
dbshell
-------------------------------------+-------------------------------------
     Reporter:  Jerome Leclanche     |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  closed
    Component:  Database layer       |                  Version:  1.10
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Aymeric Augustin):

 The reporter says he printed `queryset.query` and that query runs fast.
 This suggests:

 - either time is spent elsewhere, but I'm not sure what could account for
 a delay of several seconds on such a query
 - the query being run isn't the query he captured

 I suggest configuring PostgreSQL to log all statements (just slow
 statements could suffice), to see:

 - how much time is spent executing the statement in PostgreSQL
 - if the query executed by PostgreSQL is the same query you tested
 separately

 I'm taking bets on

 Honestly the chances that someone can reproduce the problem with the info
 you provided are slim; such problems are highly environment-dependent;
 that's why I suggest investigating further in the environment where you're
 seeing the problem.

 It seems unlikely to me that Django is at fault here so I'll leave the
 ticket closed for now.

--
Ticket URL: <https://code.djangoproject.com/ticket/27269#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.462fc88ce5410d319afa1ae981352a61%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to