~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/range.result

  • Committer: Brian Aker
  • Date: 2009-07-12 00:49:18 UTC
  • mfrom: (1063.9.51 brian-tmp-fix)
  • Revision ID: brian@gaz-20090712004918-chprmyj387ex6l8a
Merge Stewart

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
aString
146
146
believe in myself
147
147
drop table t1;
148
 
CREATE TABLE t1 (
 
148
CREATE TEMPORARY TABLE t1 (
149
149
t1ID int NOT NULL auto_increment,
150
150
art varbinary(1) NOT NULL default '',
151
151
KNR char(5) NOT NULL default '',
260
260
1       SIMPLE  t2      ref     j1      j1      4       const   1       Using index
261
261
1       SIMPLE  t1      range   i1      i1      4       NULL    3       Using where; Using index; Using join buffer
262
262
DROP TABLE t1,t2;
263
 
CREATE TABLE t1 (
 
263
CREATE TEMPORARY TABLE t1 (
264
264
a int default NULL,
265
265
b int default NULL,
266
266
KEY a (a),
301
301
15      1
302
302
47      1
303
303
DROP TABLE t1;
304
 
CREATE TABLE t1 (
 
304
CREATE TEMPORARY TABLE t1 (
305
305
id int NOT NULL AUTO_INCREMENT ,
306
306
line int NOT NULL default '0',
307
307
columnid int NOT NULL default '0',
351
351
name char(1) not null,
352
352
uid int not null,
353
353
primary key (id),
354
 
index uid_index (uid)) ENGINE=Myisam;
 
354
index uid_index (uid));
355
355
create table t2 (
356
356
id int not null auto_increment,
357
357
name char(1) not null,
358
358
uid int not null,
359
359
primary key (id),
360
 
index uid_index (uid)) engine=myisam;
 
360
index uid_index (uid));
361
361
insert into t1(id, uid, name) values(1, 0, ' ');
362
362
insert into t1(uid, name) values(0, ' ');
363
363
insert into t2(uid, name) select uid, name from t1;
415
415
analyze table t1,t2;
416
416
Table   Op      Msg_type        Msg_text
417
417
test.t1 analyze status  OK
418
 
test.t2 analyze status  Table is already up to date
 
418
test.t2 analyze status  OK
419
419
explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
420
420
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
421
 
1       SIMPLE  t1      range   uid_index       uid_index       4       NULL    112     Using where; Using MRR
422
 
1       SIMPLE  t2      ref     uid_index       uid_index       4       test.t1.uid     38      
 
421
1       SIMPLE  t1      range   uid_index       uid_index       4       NULL    #       Using where; Using MRR
 
422
1       SIMPLE  t2      ref     uid_index       uid_index       4       test.t1.uid     #       
423
423
explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid > 0;
424
424
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
425
 
1       SIMPLE  t1      range   uid_index       uid_index       4       NULL    112     Using where; Using MRR
426
 
1       SIMPLE  t2      ref     uid_index       uid_index       4       test.t1.uid     38      
 
425
1       SIMPLE  t1      range   uid_index       uid_index       4       NULL    #       Using where; Using MRR
 
426
1       SIMPLE  t2      ref     uid_index       uid_index       4       test.t1.uid     #       
427
427
explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid != 0;
428
428
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
429
 
1       SIMPLE  t1      range   uid_index       uid_index       4       NULL    113     Using where; Using MRR
430
 
1       SIMPLE  t2      ref     uid_index       uid_index       4       test.t1.uid     38      
 
429
1       SIMPLE  t1      range   uid_index       uid_index       4       NULL    #       Using where; Using MRR
 
430
1       SIMPLE  t2      ref     uid_index       uid_index       4       test.t1.uid     #       
431
431
explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid != 0;
432
432
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
433
 
1       SIMPLE  t1      range   uid_index       uid_index       4       NULL    113     Using where; Using MRR
434
 
1       SIMPLE  t2      ref     uid_index       uid_index       4       test.t1.uid     38      
 
433
1       SIMPLE  t1      range   uid_index       uid_index       4       NULL    #       Using where; Using MRR
 
434
1       SIMPLE  t2      ref     uid_index       uid_index       4       test.t1.uid     #       
435
435
select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
436
436
id      name    uid     id      name    uid
437
437
1001    A       1       1001    A       1
675
675
KEY OXLEFT (OXLEFT),
676
676
KEY OXRIGHT (OXRIGHT),
677
677
KEY OXROOTID (OXROOTID)
678
 
) ENGINE=MyISAM;
 
678
);
679
679
INSERT INTO t1 VALUES
680
680
('d8c4177d09f8b11f5.52725521','oxrootid',1,40,'d8c4177d09f8b11f5.52725521'),
681
681
('d8c4177d151affab2.81582770','d8c4177d09f8b11f5.52725521',2,3,
694
694
v.oxrootid ='d8c4177d09f8b11f5.52725521' AND
695
695
s.oxleft > v.oxleft AND s.oxleft < v.oxright;
696
696
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
697
 
1       SIMPLE  v       ref     OXLEFT,OXRIGHT,OXROOTID OXROOTID        130     const   5       Using where
698
 
1       SIMPLE  s       ALL     OXLEFT  NULL    NULL    NULL    6       Range checked for each record (index map: 0x4)
 
697
1       SIMPLE  v       ALL     OXLEFT,OXRIGHT,OXROOTID NULL    NULL    NULL    #       Using where
 
698
1       SIMPLE  s       ALL     OXLEFT  NULL    NULL    NULL    #       Range checked for each record (index map: 0x4)
699
699
SELECT s.oxid FROM t1 v, t1 s 
700
700
WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND
701
701
v.oxrootid ='d8c4177d09f8b11f5.52725521' AND
1017
1017
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1018
1018
1       SIMPLE  t1      ALL     idx1,idx2       NULL    NULL    NULL    10      Using where
1019
1019
DROP TABLE t1;
1020
 
CREATE TABLE t1 (                                      
 
1020
CREATE TEMPORARY TABLE t1 (                                      
1021
1021
item char(20) NOT NULL default '',                          
1022
1022
started datetime, 
1023
1023
price decimal(16,3) NOT NULL default '0.000',                 
1030
1030
('A2','2005-12-01 08:00:00',1000);
1031
1031
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 23:59:59';
1032
1032
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1033
 
1       SIMPLE  t1      range   PRIMARY PRIMARY 90      NULL    1       Using where; Using MRR
 
1033
1       SIMPLE  t1      range   PRIMARY PRIMARY 90      NULL    #       Using where; Using MRR
1034
1034
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 23:59:59';
1035
1035
item    started price
1036
1036
A1      2005-11-01 08:00:00     1000.000
1112
1112
DROP TABLE t1;
1113
1113
create table t1 (a int);
1114
1114
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
1115
 
create table t2 (a int, b int, filler char(100)) ENGINE=myisam;
 
1115
create table t2 (a int, b int, filler char(100));
1116
1116
insert into t2 select A.a + 10 * (B.a + 10 * C.a), 10, 'filler' from t1 A,
1117
1117
t1 B, t1 C where A.a < 5;
1118
1118
insert into t2 select 1000, b, 'filler' from t2;
1120
1120
select 'In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)' Z;
1121
1121
Z
1122
1122
In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)
1123
 
explain select * from t2 where a=1000 and b<11;
 
1123
create temporary table t2e like t2;
 
1124
alter table t2e engine=myisam;
 
1125
insert into t2e select * from t2;
 
1126
analyze table t2e;
 
1127
Table   Op      Msg_type        Msg_text
 
1128
test.t2e        analyze status  OK
 
1129
explain select * from t2e where a=1000 and b<11;
1124
1130
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1125
 
1       SIMPLE  t2      ref     a       a       5       const   502     Using where
 
1131
1       SIMPLE  t2e     ref     a       a       5       const   502     Using where
1126
1132
drop table t1, t2;
1127
1133
End of 5.1 tests
1128
1134
CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(c1));