diff options
author | Chaithra Gopalareddy <chaithra.gopalareddy@oracle.com> | 2012-07-18 15:18:15 +0530 |
---|---|---|
committer | Chaithra Gopalareddy <chaithra.gopalareddy@oracle.com> | 2012-07-18 15:18:15 +0530 |
commit | 0e729b5d5392a0fba0f6f0d2f874626378b94c09 (patch) | |
tree | 12b36297f268d844986157f91e639104f99f404f /sql | |
parent | 1b4523488adba11db06dc250943478fb912833e7 (diff) | |
parent | a56c4692d4ef160f567f2301ef763f505deed1b1 (diff) | |
download | mariadb-git-0e729b5d5392a0fba0f6f0d2f874626378b94c09.tar.gz |
Merge from 5.1 to 5.5
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_select.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 42e9fbfa650..8f4439c4dc1 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1520,12 +1520,19 @@ JOIN::optimize() DBUG_RETURN(1); } } - + /* + Calculate a possible 'limit' of table rows for 'GROUP BY': 'need_tmp' + implies that there will be more postprocessing so the specified + 'limit' should not be enforced yet in the call to + 'test_if_skip_sort_order'. + */ + const ha_rows limit = need_tmp ? HA_POS_ERROR : unit->select_limit_cnt; + if (!(select_options & SELECT_BIG_RESULT) && ((group_list && (!simple_group || !test_if_skip_sort_order(&join_tab[const_tables], group_list, - unit->select_limit_cnt, 0, + limit, 0, &join_tab[const_tables].table-> keys_in_use_for_group_by))) || select_distinct) && |