diff options
author | unknown <sasha@mysql.sashanet.com> | 2001-08-09 19:16:15 -0600 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2001-08-09 19:16:15 -0600 |
commit | ade2a371187ff5e810fd732908071c338807bb32 (patch) | |
tree | ed06f905f1515a2117cc0c243c526264fccaac77 /mysql-test/t/order_by.test | |
parent | 11a766674366b56d678ad0610d396ae1b54a75bd (diff) | |
parent | e415d5620181913d069cefc758ea84f0bf8d3933 (diff) | |
download | mariadb-git-ade2a371187ff5e810fd732908071c338807bb32.tar.gz |
merged
BitKeeper/etc/logging_ok:
auto-union
BitKeeper/etc/ignore:
auto-union
Makefile.am:
Auto merged
ltmain.sh:
Auto merged
libmysql/Makefile.shared:
Auto merged
libmysql/libmysql.c:
Auto merged
myisam/myisamchk.c:
Auto merged
mysql-test/t/bdb.test:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_select.cc:
Auto merged
Diffstat (limited to 'mysql-test/t/order_by.test')
-rw-r--r-- | mysql-test/t/order_by.test | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 08d26413761..baa3fe67f0b 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -254,3 +254,41 @@ select * from t1 where a between 0 and 1 order by a desc, b desc; drop table t1; +CREATE TABLE t1 ( + gid int(10) unsigned NOT NULL auto_increment, + cid smallint(5) unsigned NOT NULL default '0', + PRIMARY KEY (gid), + KEY component_id (cid) +) TYPE=MyISAM; +INSERT INTO t1 VALUES (103853,108),(103867,108),(103962,108),(104505,108),(104619,108),(104620,108); +ALTER TABLE t1 add skr int(10) not null; + +CREATE TABLE t2 ( + gid int(10) unsigned NOT NULL default '0', + uid smallint(5) unsigned NOT NULL default '1', + sid tinyint(3) unsigned NOT NULL default '1', + PRIMARY KEY (gid), + KEY uid (uid), + KEY status_id (sid) +) TYPE=MyISAM; +INSERT INTO t2 VALUES (103853,250,5),(103867,27,5),(103962,27,5),(104505,117,5),(104619,75,5),(104620,15,5); + +CREATE TABLE t3 ( + uid smallint(6) NOT NULL auto_increment, + PRIMARY KEY (uid) +) TYPE=MyISAM; +INSERT INTO t3 VALUES (1),(15),(27),(75),(117),(250); +ALTER TABLE t3 add skr int(10) not null; + +select t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid; +select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid; + +# The following ORDER BY can be optimimized +EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and t2.uid = t3.uid order by t1.gid, t3.uid; +EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr; + +# The following ORDER BY can't be optimimized +EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid; +EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid; +EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr; +drop table t1,t2,t3; |