summaryrefslogtreecommitdiff
path: root/mysql-test/t/explain.test
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-05-29 22:16:45 +0400
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-05-29 22:16:45 +0400
commitf3a83073972b510ffee922aac37434946ae0e0bc (patch)
tree77ac3c0c9d9c26af9a5b121f75e54a423aadff7e /mysql-test/t/explain.test
parentd72a4710aaad2f1e76ac20d50793f13f941ef899 (diff)
downloadmariadb-git-f3a83073972b510ffee922aac37434946ae0e0bc.tar.gz
Bug #48537: difference of index selection between rpm binary
and .tar.gz, windows vs linux.. On Intel x86 machines index selection by the MySQL query optimizer could sometimes depend on the compiler version and optimization flags used to build the server binary. The problem was a result of a known issue with floating point calculations on x86: since internal FPU precision (80 bit) differs from precision used by programs (32-bit float or 64-bit double), the result of calculating a complex expression may depend on how FPU registers are allocated by the compiler and whether intermediate values are spilled from FPU to memory. In this particular case compiler versions and optimization flags had an effect on cost calculation when choosing the best index in best_access_path(). A possible solution to this problem which has already been implemented in mysql-trunk is to limit FPU internal precision to 64 bits. So the fix is a backport of the relevant code to 5.1 from mysql-trunk. configure.in: Configure check for fpu_control.h mysql-test/r/explain.result: Test case for bug #48537. mysql-test/t/explain.test: Test case for bug #48537. sql/mysqld.cc: Backport of the code to switch FPU on x86 to 64-bit precision.
Diffstat (limited to 'mysql-test/t/explain.test')
-rw-r--r--mysql-test/t/explain.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index ba6be72dbdc..b635a1b2968 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -213,4 +213,19 @@ EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND
DROP TABLE t1, t2;
+--echo #
+--echo # Bug #48573: difference of index selection between rpm binary and
+--echo # .tar.gz, windows vs linux..
+--echo #
+
+CREATE TABLE t1(c1 INT, c2 INT, c4 INT, c5 INT, KEY(c2, c5), KEY(c2, c4, c5));
+INSERT INTO t1 VALUES(4, 1, 1, 1);
+INSERT INTO t1 VALUES(3, 1, 1, 1);
+INSERT INTO t1 VALUES(2, 1, 1, 1);
+INSERT INTO t1 VALUES(1, 1, 1, 1);
+
+EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1;
+
+DROP TABLE t1;
+
--echo End of 5.1 tests.