Moved select_sql in SQLCompiler.get_extra_select() to improve performance.

This commit is contained in:
Mariusz Felisiak 2017-09-02 22:39:51 +02:00 committed by Tim Graham
parent 48d92fea67
commit 2470756de0
1 changed files with 1 additions and 1 deletions

View File

@ -357,8 +357,8 @@ class SQLCompiler:
def get_extra_select(self, order_by, select):
extra_select = []
select_sql = [t[1] for t in select]
if self.query.distinct and not self.query.distinct_fields:
select_sql = [t[1] for t in select]
for expr, (sql, params, is_ref) in order_by:
without_ordering = self.ordering_parts.search(sql).group(1)
if not is_ref and (without_ordering, params) not in select_sql: