Changes between Version 1 and Version 2 of Ticket #33973, comment 1


Ignore:
Timestamp:
Sep 1, 2022, 11:12:48 AM (2 years ago)
Author:
Marc Parizeau

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33973, comment 1

    v1 v2  
    11After more digging, it appears that the two worst culprits in my query are the 1st and 3rd `Exists`. The 1st is about 10x slower on 3.2.15 than on 3.1.14. The 3rd is about 6x slower on 3.2.15 than on 3.1.14. The execution times for the 2nd and 4th `Exists` are about the same for 3.2 and 3.1.
    22
    3 If I use only the 1st `Exists` in my query, by commenting out the 3 others, and by adding a False for the `Greatest` requirement of min 2 args, I obtain de following explanations (I also removed the `order_by` and `select_related` clauses to simplify the query as much as possible):
     3If I use only the 1st `Exists` in my query, by commenting out the 3 others, and by adding a False for the `Greatest` requirement of min 2 args, I obtain de following **explanations** (I also removed the `order_by` and `select_related` clauses to simplify the query as much as possible):
    44
    5 On Django 3.1.14:
     5**On Django 3.1.14**:
    66
    77{{{
     
    4444}}}
    4545
    46 On Django 3.2.15:
     46**On Django 3.2.15**:
    4747
    4848{{{
     
    7676}}}
    7777
    78 So it appears that the strategies of the two Django versions are indeed not the same. And it also appears that the regression stems from the implementation of the `exclude(threadentry__user=user)` clause.
     78So it appears that the SQL strategies of the two Django versions are indeed not the same. And it also appears that the regression stems from the implementation of the `exclude(threadentry__user=user)` clause (reverse traversal of the thread entry FK).
    7979
    8080Hope this info can help a gourou isolate the problem source (SQL optimization is out of my league).
Back to Top