Commit faaf239f authored by gkodinov/kgeorge@magare.gmz's avatar gkodinov/kgeorge@magare.gmz

Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-bugteam

into  magare.gmz:/home/kgeorge/mysql/autopush/B35206-5.1-bugteam
parents 7c447021 cde380ea
...@@ -1428,3 +1428,33 @@ set session max_sort_length= 2180; ...@@ -1428,3 +1428,33 @@ set session max_sort_length= 2180;
select * from t1 order by b; select * from t1 order by b;
ERROR HY001: Out of sort memory; increase server sort buffer size ERROR HY001: Out of sort memory; increase server sort buffer size
drop table t1; drop table t1;
CREATE TABLE t2 (a varchar(32), b int(11), c float, d double,
UNIQUE KEY a (a,b,c), KEY b (b), KEY c (c));
CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b));
CREATE TABLE t3 (a varchar(32), b char(3), UNIQUE KEY a (a,b));
INSERT INTO t3 SELECT * FROM t1;
EXPLAIN
SELECT d FROM t1, t2
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
ORDER BY t2.c LIMIT 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a,b b 4 const 4 Using where; Using temporary; Using filesort
1 SIMPLE t2 ref a,b,c a 40 test.t1.a,const 11 Using where
SELECT d FROM t1, t2
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
ORDER BY t2.c LIMIT 1;
d
52.5
EXPLAIN
SELECT d FROM t3 AS t1, t2 AS t2
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
ORDER BY t2.c LIMIT 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a,b,c c 5 NULL 420 Using where
1 SIMPLE t1 ref a a 39 test.t2.a,const 10 Using where; Using index
SELECT d FROM t3 AS t1, t2 AS t2
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
ORDER BY t2.c LIMIT 1;
d
52.5
DROP TABLE t1,t2,t3;
This diff is collapsed.
...@@ -13177,6 +13177,23 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, ...@@ -13177,6 +13177,23 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
tab->limit= select_limit; tab->limit= select_limit;
} }
} }
else if (tab->type != JT_ALL)
{
/*
We're about to use a quick access to the table.
We need to change the access method so as the quick access
method is actually used.
*/
DBUG_ASSERT(tab->select->quick);
tab->type=JT_ALL;
tab->use_quick=1;
tab->ref.key= -1;
tab->ref.key_parts=0; // Don't use ref key.
tab->read_first_record= join_init_read_record;
/*
TODO: update the number of records in join->best_positions[tablenr]
*/
}
} }
used_key_parts= best_key_parts; used_key_parts= best_key_parts;
order_direction= best_key_direction; order_direction= best_key_direction;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment