1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Optimization of key usage (ORDER BY) (SCRUM)

This commit is contained in:
ram@mysql.r18.ru
2003-01-04 14:59:52 +04:00
parent 259b79beac
commit a7ef436bc4
3 changed files with 139 additions and 0 deletions

View File

@@ -330,3 +330,24 @@ INSERT INTO t2 (numeropost,pseudo) VALUES (1,'joce'),(1,'bug');
SELECT titre,t1.numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
drop table t1,t2;
#
# Test of test_if_subkey() function
#
CREATE TABLE t1 (
FieldKey varchar(36) NOT NULL default '',
LongVal bigint(20) default NULL,
StringVal mediumtext,
KEY FieldKey (FieldKey),
KEY LongField (FieldKey,LongVal),
KEY StringField (FieldKey,StringVal(32))
);
INSERT INTO t1 VALUES ('0',3,'0'),('1',2,'1'),('1',1,'3'), ('1',0,'2');
EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
EXPLAIN SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY LongVal;
SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY LongVal;
EXPLAIN SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY FieldKey, LongVal;
SELECT * FROM t1 WHERE FieldKey > '0' ORDER BY FieldKey, LongVal;
DROP TABLE t1;