mirror of
https://github.com/MariaDB/server.git
synced 2025-08-31 22:22:30 +03:00
Merge gshchepa@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt
This commit is contained in:
@@ -1134,6 +1134,7 @@ JOIN::optimize()
|
||||
order=0; // The output has only one row
|
||||
simple_order=1;
|
||||
select_distinct= 0; // No need in distinct for 1 row
|
||||
group_optimized_away= 1;
|
||||
}
|
||||
|
||||
calc_group_buffer(this, group_list);
|
||||
@@ -11742,7 +11743,8 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
||||
if (!join->first_record || end_of_records ||
|
||||
(idx=test_if_group_changed(join->group_fields)) >= 0)
|
||||
{
|
||||
if (join->first_record || (end_of_records && !join->group))
|
||||
if (join->first_record ||
|
||||
(end_of_records && !join->group && !join->group_optimized_away))
|
||||
{
|
||||
if (join->procedure)
|
||||
join->procedure->end_group();
|
||||
|
@@ -321,6 +321,14 @@ public:
|
||||
ROLLUP rollup; // Used with rollup
|
||||
|
||||
bool select_distinct; // Set if SELECT DISTINCT
|
||||
/*
|
||||
If we have the GROUP BY statement in the query,
|
||||
but the group_list was emptied by optimizer, this
|
||||
flag is TRUE.
|
||||
It happens when fields in the GROUP BY are from
|
||||
constant table
|
||||
*/
|
||||
bool group_optimized_away;
|
||||
|
||||
/*
|
||||
simple_xxxxx is set if ORDER/GROUP BY doesn't include any references
|
||||
@@ -429,6 +437,7 @@ public:
|
||||
zero_result_cause= 0;
|
||||
optimized= 0;
|
||||
cond_equal= 0;
|
||||
group_optimized_away= 0;
|
||||
|
||||
all_fields= fields_arg;
|
||||
fields_list= fields_arg;
|
||||
|
Reference in New Issue
Block a user