mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fix for wrongly calculated Examined_rows in 4.0 UNION's.
sql/sql_union.cc: Fixing a non-critical bug in 4.0 UNION's which results in erronously calculated number o fexamined rows. This value is displayed in the slow query log. This is a bug number #5879.
This commit is contained in:
@@ -39,6 +39,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
|
|||||||
TABLE_LIST *first_table=(TABLE_LIST *)lex->select_lex.table_list.first;
|
TABLE_LIST *first_table=(TABLE_LIST *)lex->select_lex.table_list.first;
|
||||||
TMP_TABLE_PARAM tmp_table_param;
|
TMP_TABLE_PARAM tmp_table_param;
|
||||||
select_union *union_result;
|
select_union *union_result;
|
||||||
|
ha_rows examined_rows= 0;
|
||||||
DBUG_ENTER("mysql_union");
|
DBUG_ENTER("mysql_union");
|
||||||
|
|
||||||
/* Fix tables 'to-be-unioned-from' list to point at opened tables */
|
/* Fix tables 'to-be-unioned-from' list to point at opened tables */
|
||||||
@@ -202,6 +203,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
|
|||||||
union_result);
|
union_result);
|
||||||
if (res)
|
if (res)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
examined_rows+= thd->examined_row_count;
|
||||||
/* Needed for the following test and for records_at_start in next loop */
|
/* Needed for the following test and for records_at_start in next loop */
|
||||||
table->file->info(HA_STATUS_VARIABLE);
|
table->file->info(HA_STATUS_VARIABLE);
|
||||||
if (found_rows_for_union & sl->options)
|
if (found_rows_for_union & sl->options)
|
||||||
@@ -258,12 +260,15 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
|
|||||||
if (describe)
|
if (describe)
|
||||||
thd->select_limit= HA_POS_ERROR; // no limit
|
thd->select_limit= HA_POS_ERROR; // no limit
|
||||||
|
|
||||||
res=mysql_select(thd,&result_table_list,
|
res= mysql_select(thd,&result_table_list,
|
||||||
item_list, NULL, (describe) ? 0 : order,
|
item_list, NULL, (describe) ? 0 : order,
|
||||||
(ORDER*) NULL, NULL, (ORDER*) NULL,
|
(ORDER*) NULL, NULL, (ORDER*) NULL,
|
||||||
thd->options, result);
|
thd->options, result);
|
||||||
if (!res)
|
if (!res)
|
||||||
thd->limit_found_rows = (ulonglong)table->file->records + add_rows;
|
{
|
||||||
|
thd->limit_found_rows= (ulonglong)table->file->records + add_rows;
|
||||||
|
thd->examined_row_count+= examined_rows;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user