summaryrefslogtreecommitdiff
path: root/mysql-test/r/union.result
diff options
context:
space:
mode:
authormithun <mithun.c.y@oracle.com>2014-05-08 14:49:53 +0530
committermithun <mithun.c.y@oracle.com>2014-05-08 14:49:53 +0530
commit263d47d3a1a5c007d3f7675605e1412c3128ca70 (patch)
treef4850420e2ee2b793d1dc87100218d1e719ed37b /mysql-test/r/union.result
parentb9c03d41e492984bdea2da923eac1e62cf5264f7 (diff)
downloadmariadb-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 'mysql-test/r/union.result')
-rw-r--r--mysql-test/r/union.result34
1 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 0fd1526684a..97c1a8b4d49 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1826,3 +1826,37 @@ dev
SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
dev
1
+#
+# Bug #17059925 : UNIONS COMPUTES ROWS_EXAMINED INCORRECTLY
+#
+SET @old_slow_query_log= @@global.slow_query_log;
+SET @old_log_output= @@global.log_output;
+SET @old_long_query_time= @@long_query_time;
+SET GLOBAL log_output= "TABLE";
+SET GLOBAL slow_query_log= ON;
+SET SESSION long_query_time= 0;
+CREATE TABLE t17059925 (a INT);
+CREATE TABLE t2 (b INT);
+CREATE TABLE t3 (c INT);
+INSERT INTO t17059925 VALUES (1), (2), (3);
+INSERT INTO t2 VALUES (4), (5), (6);
+INSERT INTO t3 VALUES (7), (8), (9);
+TRUNCATE table mysql.slow_log;
+SELECT * FROM t17059925 UNION SELECT * FROM t2 UNION SELECT * FROM t3;
+a
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SELECT sql_text, rows_examined FROM mysql.slow_log WHERE sql_text LIKE '%SELECT%t17059925%';
+sql_text rows_examined
+SELECT * FROM t17059925 UNION SELECT * FROM t2 UNION SELECT * FROM t3 18
+DROP TABLE t17059925, t2, t3;
+SET @@long_query_time= @old_long_query_time;
+SET @@global.log_output= @old_log_output;
+SET @@global.slow_query_log= @old_slow_query_log;