mirror of
https://github.com/django/django.git
synced 2025-12-08 02:36:40 +00:00
If an SQL query doesn't specify any ordering, avoid the implicit sort
that happens with MySQL when a "GROUP BY" clause is included. This is a backend-specific operation, so any other databases requiring similar encouragement can have a function added to their own backend code. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9637 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
7030ab9a72
commit
a1cbeb9afb
4 changed files with 36 additions and 0 deletions
|
|
@ -288,6 +288,8 @@ class BaseQuery(object):
|
|||
if self.group_by:
|
||||
grouping = self.get_grouping()
|
||||
result.append('GROUP BY %s' % ', '.join(grouping))
|
||||
if not ordering:
|
||||
ordering = self.connection.ops.force_no_ordering()
|
||||
|
||||
if self.having:
|
||||
having, h_params = self.get_having()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue