diff options
author | mithun <mithun.c.y@oracle.com> | 2014-05-08 14:49:53 +0530 |
---|---|---|
committer | mithun <mithun.c.y@oracle.com> | 2014-05-08 14:49:53 +0530 |
commit | 263d47d3a1a5c007d3f7675605e1412c3128ca70 (patch) | |
tree | f4850420e2ee2b793d1dc87100218d1e719ed37b /sql/sql_union.cc | |
parent | b9c03d41e492984bdea2da923eac1e62cf5264f7 (diff) | |
download | mariadb-git-263d47d3a1a5c007d3f7675605e1412c3128ca70.tar.gz |
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.
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index d0660e8f117..d230b903d2c 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -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; |