summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@macbook.local>2006-10-09 19:53:07 +0400
committerunknown <gkodinov/kgeorge@macbook.local>2006-10-09 19:53:07 +0400
commit09dfd9e7e4925b357e090a133d6e38e355dda3f5 (patch)
tree73c5f364a8ae3a5d68cf62062509c72c44d6c109 /sql/sql_select.cc
parent9055f98e89f544d452a8ac0ce6a3d6df40602763 (diff)
parent45cad70ff4b9e191e9ac553298e25fe500a747c5 (diff)
downloadmariadb-git-09dfd9e7e4925b357e090a133d6e38e355dda3f5.tar.gz
Merge bk-internal:/home/bk/mysql-5.0-opt
into macbook.local:/Users/kgeorge/mysql/work/B22781-5.0-opt sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b814bd1d565..3935029190b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1399,7 +1399,8 @@ JOIN::exec()
simple_order= simple_group;
skip_sort_order= 0;
}
- if (order &&
+ if (order &&
+ (order != group_list || !(select_options & SELECT_BIG_RESULT)) &&
(const_tables == tables ||
((simple_order || skip_sort_order) &&
test_if_skip_sort_order(&join_tab[const_tables], order,
@@ -11995,11 +11996,17 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
table= tab->table;
select= tab->select;
- if (test_if_skip_sort_order(tab,order,select_limit,0))
+ /*
+ When there is SQL_BIG_RESULT do not sort using index for GROUP BY,
+ and thus force sorting on disk.
+ */
+ if ((order != join->group_list ||
+ !(join->select_options & SELECT_BIG_RESULT)) &&
+ test_if_skip_sort_order(tab,order,select_limit,0))
DBUG_RETURN(0);
if (!(sortorder=make_unireg_sortorder(order,&length)))
goto err; /* purecov: inspected */
- /* It's not fatal if the following alloc fails */
+
table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),
MYF(MY_WME | MY_ZEROFILL));
table->status=0; // May be wrong if quick_select