summaryrefslogtreecommitdiff
path: root/mysql-test/r/select.result
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/hfmain.(none)>2008-02-17 15:48:17 +0400
committerunknown <holyfoot/hf@mysql.com/hfmain.(none)>2008-02-17 15:48:17 +0400
commitd6be1a9b957b47c2cf67590932629984c1ef5a14 (patch)
treecbb7ff1ee1b9212bd469b0a0322e2da0545c69f5 /mysql-test/r/select.result
parent12504d906bfabdd64938e313d3ac2d88b490834d (diff)
downloadmariadb-git-d6be1a9b957b47c2cf67590932629984c1ef5a14.tar.gz
Bug #32942 now() - interval '7200' second NOT pre-calculated, causing "full table scan"
Problem is not about intervals and doesn't actually cause 'full table scan'. We have an optimization for DISTINCT when we have 'DISTINCT field_from_first_join_table' we don't need to read all the rows from the JOIN-ed table if we found one conforming row. It stopped working in 5.0 as we return NESTED_LOOP_OK if we came upon that case in the evaluate_join_record() and that doesn't break the recordreading loop in sub_select(). Fixed by returning NESTED_LOOP_NO_MORE_ROWS in this case. mysql-test/r/select.result: Bug #32942 now() - interval '7200' second is NOT pre-calculated, causing "full table scan". test result mysql-test/t/select.test: Bug #32942 now() - interval '7200' second is NOT pre-calculated, causing "full table scan" test case sql/sql_select.cc: Bug #32942 now() - interval '7200' second NOT pre-calculated, causing "full table scan" return NESTED_LOOP_NO_MORE_ROWS when we don't need to read rows from this table anymore
Diffstat (limited to 'mysql-test/r/select.result')
-rw-r--r--mysql-test/r/select.result21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 3ca84bcf34b..b70809d5d78 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4328,4 +4328,25 @@ SELECT * FROM t1 WHERE c1 > NULL + 1;
c1
DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT);
+CREATE TABLE t2 (a INT, c INT, KEY(a));
+INSERT INTO t1 VALUES (1, 1), (2, 2);
+INSERT INTO t2 VALUES (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),
+(2, 1), (2, 2), (2, 3), (2, 4), (2, 5),
+(3, 1), (3, 2), (3, 3), (3, 4), (3, 5),
+(4, 1), (4, 2), (4, 3), (4, 4), (4, 5);
+FLUSH STATUS;
+SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3;
+b
+1
+2
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 2
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 6
+DROP TABLE t1, t2;
End of 5.0 tests