~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/range.test

  • Committer: Monty Taylor
  • Date: 2009-04-14 19:16:51 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 994.
  • Revision ID: mordred@inaugust.com-20090414191651-ltbww6hpqks8k7qk
Clarified instructions in README.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
                      (3,1999,35,0,'1999-07-12');
63
63
select YEAR,ISSUE from t1 where PAPER_ID=3 and (YEAR>1999 or (YEAR=1999 and ISSUE>28))  order by YEAR,ISSUE;
64
64
check table t1;
 
65
repair table t1;
65
66
drop table t1;
66
67
 
67
68
CREATE TABLE t1 (
115
116
# Problem with binary strings
116
117
#
117
118
 
118
 
CREATE TEMPORARY TABLE t1 (
 
119
CREATE TABLE t1 (
119
120
  t1ID int NOT NULL auto_increment,
120
121
  art varbinary(1) NOT NULL default '',
121
122
  KNR char(5) NOT NULL default '',
209
210
# bug #1724: use RANGE on more selective column instead of REF on less
210
211
# selective
211
212
 
212
 
CREATE TEMPORARY TABLE t1 (
 
213
CREATE TABLE t1 (
213
214
  a int default NULL,
214
215
  b int default NULL,
215
216
  KEY a (a),
260
261
# Test of problem with IN on many different keyparts. (Bug #4157)
261
262
#
262
263
 
263
 
CREATE TEMPORARY TABLE t1 (
 
264
CREATE TABLE t1 (
264
265
id int NOT NULL AUTO_INCREMENT ,
265
266
line int NOT NULL default '0',
266
267
columnid int NOT NULL default '0',
312
313
  name char(1) not null,
313
314
  uid int not null,
314
315
  primary key (id),
315
 
  index uid_index (uid));
 
316
  index uid_index (uid)) ENGINE=Myisam;
316
317
  
317
318
create table t2 (
318
319
  id int not null auto_increment,
319
320
  name char(1) not null,
320
321
  uid int not null,
321
322
  primary key (id),
322
 
  index uid_index (uid));
 
323
  index uid_index (uid)) engine=myisam;
323
324
  
324
325
insert into t1(id, uid, name) values(1, 0, ' ');
325
326
insert into t1(uid, name) values(0, ' ');
379
380
 
380
381
analyze table t1,t2;
381
382
 
382
 
--replace_column 3 # 8 # 9 #
383
383
explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
384
 
--replace_column 3 # 8 # 9 #
385
384
explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid > 0;
386
 
--replace_column 3 # 8 # 9 #
387
385
explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid != 0;
388
 
--replace_column 3 # 8 # 9 #
389
386
explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid != 0;
390
387
 
391
388
select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
540
537
  KEY OXLEFT (OXLEFT),
541
538
  KEY OXRIGHT (OXRIGHT),
542
539
  KEY OXROOTID (OXROOTID)
543
 
);
 
540
) ENGINE=MyISAM;
544
541
 
545
542
INSERT INTO t1 VALUES
546
543
('d8c4177d09f8b11f5.52725521','oxrootid',1,40,'d8c4177d09f8b11f5.52725521'),
555
552
('d8c4177d24ccef970.14957924','d8c4177d09f8b11f5.52725521',10,11,
556
553
 'd8c4177d09f8b11f5.52725521');
557
554
 
558
 
--replace_column 3 # 8 # 9 #
559
555
EXPLAIN
560
556
SELECT s.oxid FROM t1 v, t1 s 
561
557
  WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND
792
788
create table t2 (a varchar(10), filler char(200), key(a));
793
789
insert into t2 select * from t1;
794
790
 
795
 
--replace_column 3 # 8 # 9 #
 
791
--replace_column 9 #
796
792
explain select * from t1 where a between 'a' and 'a '; 
797
 
--replace_column 3 # 8 # 9 #
 
793
--replace_column 9 #
798
794
explain select * from t1 where a = 'a' or a='a ';
799
795
 
800
 
--replace_column 3 # 8 # 9 #
 
796
--replace_column 9 #
801
797
explain select * from t2 where a between 'a' and 'a '; 
802
 
--replace_column 3 # 8 # 9 #
 
798
--replace_column 9 #
803
799
explain select * from t2 where a = 'a' or a='a ';
804
800
 
805
801
update t1 set a='b' where a<>'a';
806
 
--replace_column 3 # 8 # 9 #
 
802
--replace_column 9 #
807
803
explain select * from t1 where a not between 'b' and 'b'; 
808
804
select a, hex(filler) from t1 where a not between 'b' and 'b'; 
809
805
 
842
838
#             when a range condition use an invalid datetime constant 
843
839
#
844
840
 
845
 
CREATE TEMPORARY TABLE t1 (                                      
 
841
CREATE TABLE t1 (                                      
846
842
  item char(20) NOT NULL default '',                          
847
843
  started datetime, 
848
844
  price decimal(16,3) NOT NULL default '0.000',                 
855
851
('A1','2005-12-12 08:00:00',3000),
856
852
('A2','2005-12-01 08:00:00',1000);
857
853
 
858
 
--replace_column 3 # 8 # 9 #
859
854
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 23:59:59';
860
855
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 23:59:59';
861
856
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
961
956
create table t1 (a int);
962
957
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
963
958
 
964
 
create table t2 (a int, b int, filler char(100));
 
959
create table t2 (a int, b int, filler char(100)) ENGINE=myisam;
965
960
insert into t2 select A.a + 10 * (B.a + 10 * C.a), 10, 'filler' from t1 A,
966
961
t1 B, t1 C where A.a < 5;
967
962
 
978
973
# 500 rows, 1 row
979
974
 
980
975
select 'In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)' Z;
981
 
create temporary table t2e like t2;
982
 
alter table t2e engine=myisam;
983
 
insert into t2e select * from t2;
984
 
analyze table t2e;
985
 
explain select * from t2e where a=1000 and b<11;
 
976
explain select * from t2 where a=1000 and b<11;
986
977
 
987
978
drop table t1, t2;
988
979