1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.1-opt

into  ramayana.hindu.god:/home/tsmith/m/bk/maint/51
This commit is contained in:
tsmith@ramayana.hindu.god
2007-08-01 18:40:02 -06:00
43 changed files with 1397 additions and 204 deletions

View File

@ -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();
@ -12313,7 +12315,6 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
*/
if (!on_primary_key &&
(table->file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) &&
ha_legacy_type(table->s->db_type()) == DB_TYPE_INNODB &&
table->s->primary_key != MAX_KEY)
{
on_primary_key= TRUE;