1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug #17059925: UNIONS COMPUTES ROWS_EXAMINED INCORRECTLY

ISSUE:
------
For UNION of selects, rows examined by the query will be sum
of rows examined by individual select operations and rows
examined for union operation. The value of session level
global counter that is used to count the rows examined by a
select statement should be accumulated and reset before it
is used for next select statement. But we have missed to
reset the same. Because of this examined row count of a
select query is accounted more than once.

SOLUTION:
---------
In union reset the session level global counter used to
accumulate count of examined rows after its value is saved.
This commit is contained in:
mithun
2014-05-08 14:49:53 +05:30
parent b9c03d41e4
commit 263d47d3a1
3 changed files with 72 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -557,7 +557,13 @@ bool st_select_lex_unit::exec()
0);
if (!saved_error)
{
/*
Save the current examined row count locally and clear the global
counter, so that we can accumulate the number of evaluated rows for
the current query block.
*/
examined_rows+= thd->examined_row_count;
thd->examined_row_count= 0;
if (union_result->flush())
{
thd->lex->current_select= lex_select_save;