1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

BUG#8924 'Explain' shows different strategy

- If number of records in table is 4, the calculated cost for using "index" and "range" become so close so that any rounding errors becomes visible.
 - Added one more record to the tables for heap test and expoect "range" to be selected
 - Decrease number of records in t1 for range and expect "index" to be choosen.
This commit is contained in:
msvensson@neptunus.(none)
2005-04-12 12:04:43 +02:00
parent f9dd856d9e
commit 7387030e67
8 changed files with 13 additions and 13 deletions

View File

@ -250,18 +250,18 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index x x 5 NULL 9 Using where; Using index
drop table t1;
CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1));
INSERT INTO t1 VALUES (0),(0),(1),(1);
INSERT INTO t1 VALUES (0),(1),(1);
CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya));
INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2);
explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref j1 j1 4 const 1 Using index
1 SIMPLE t1 index i1 i1 4 NULL 4 Using where; Using index
1 SIMPLE t1 index i1 i1 4 NULL 3 Using where; Using index
explain select * from t1 force index(i1), t2 force index(j1) where
(t1.key1 <t2.keya + 1) and t2.keya=3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref j1 j1 4 const 1 Using index
1 SIMPLE t1 index i1 i1 4 NULL 4 Using where; Using index
1 SIMPLE t1 index i1 i1 4 NULL 3 Using where; Using index
DROP TABLE t1,t2;
CREATE TABLE t1 (
a int(11) default NULL,