~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/range.test

  • 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:
115
115
# Problem with binary strings
116
116
#
117
117
 
118
 
CREATE TABLE t1 (
 
118
CREATE TEMPORARY TABLE t1 (
119
119
  t1ID int NOT NULL auto_increment,
120
120
  art varbinary(1) NOT NULL default '',
121
121
  KNR char(5) NOT NULL default '',
209
209
# bug #1724: use RANGE on more selective column instead of REF on less
210
210
# selective
211
211
 
212
 
CREATE TABLE t1 (
 
212
CREATE TEMPORARY TABLE t1 (
213
213
  a int default NULL,
214
214
  b int default NULL,
215
215
  KEY a (a),
260
260
# Test of problem with IN on many different keyparts. (Bug #4157)
261
261
#
262
262
 
263
 
CREATE TABLE t1 (
 
263
CREATE TEMPORARY TABLE t1 (
264
264
id int NOT NULL AUTO_INCREMENT ,
265
265
line int NOT NULL default '0',
266
266
columnid int NOT NULL default '0',
312
312
  name char(1) not null,
313
313
  uid int not null,
314
314
  primary key (id),
315
 
  index uid_index (uid)) ENGINE=Myisam;
 
315
  index uid_index (uid));
316
316
  
317
317
create table t2 (
318
318
  id int not null auto_increment,
319
319
  name char(1) not null,
320
320
  uid int not null,
321
321
  primary key (id),
322
 
  index uid_index (uid)) engine=myisam;
 
322
  index uid_index (uid));
323
323
  
324
324
insert into t1(id, uid, name) values(1, 0, ' ');
325
325
insert into t1(uid, name) values(0, ' ');
379
379
 
380
380
analyze table t1,t2;
381
381
 
 
382
--replace_column 9 #
382
383
explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
 
384
--replace_column 9 #
383
385
explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid > 0;
 
386
--replace_column 9 #
384
387
explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid != 0;
 
388
--replace_column 9 #
385
389
explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid != 0;
386
390
 
387
391
select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
536
540
  KEY OXLEFT (OXLEFT),
537
541
  KEY OXRIGHT (OXRIGHT),
538
542
  KEY OXROOTID (OXROOTID)
539
 
) ENGINE=MyISAM;
 
543
);
540
544
 
541
545
INSERT INTO t1 VALUES
542
546
('d8c4177d09f8b11f5.52725521','oxrootid',1,40,'d8c4177d09f8b11f5.52725521'),
551
555
('d8c4177d24ccef970.14957924','d8c4177d09f8b11f5.52725521',10,11,
552
556
 'd8c4177d09f8b11f5.52725521');
553
557
 
 
558
--replace_column 9 #
554
559
EXPLAIN
555
560
SELECT s.oxid FROM t1 v, t1 s 
556
561
  WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND
837
842
#             when a range condition use an invalid datetime constant 
838
843
#
839
844
 
840
 
CREATE TABLE t1 (                                      
 
845
CREATE TEMPORARY TABLE t1 (                                      
841
846
  item char(20) NOT NULL default '',                          
842
847
  started datetime, 
843
848
  price decimal(16,3) NOT NULL default '0.000',                 
850
855
('A1','2005-12-12 08:00:00',3000),
851
856
('A2','2005-12-01 08:00:00',1000);
852
857
 
 
858
--replace_column 9 #
853
859
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 23:59:59';
854
860
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 23:59:59';
855
861
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
955
961
create table t1 (a int);
956
962
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
957
963
 
958
 
create table t2 (a int, b int, filler char(100)) ENGINE=myisam;
 
964
create table t2 (a int, b int, filler char(100));
959
965
insert into t2 select A.a + 10 * (B.a + 10 * C.a), 10, 'filler' from t1 A,
960
966
t1 B, t1 C where A.a < 5;
961
967
 
972
978
# 500 rows, 1 row
973
979
 
974
980
select 'In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)' Z;
975
 
explain select * from t2 where a=1000 and b<11;
 
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
986
 
977
987
drop table t1, t2;
978
988