~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/range.result

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
253
253
explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
254
254
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
255
255
1       SIMPLE  t2      ref     j1      j1      4       const   1       Using index
256
 
1       SIMPLE  t1      range   i1      i1      4       NULL    3       Using where; Using index; Using join buffer
 
256
1       SIMPLE  t1      index   i1      i1      4       NULL    7       Using where; Using index; Using join buffer
257
257
explain select * from t1 force index(i1), t2 force index(j1) where 
258
258
(t1.key1 <t2.keya + 1) and t2.keya=3;
259
259
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
260
260
1       SIMPLE  t2      ref     j1      j1      4       const   1       Using index
261
 
1       SIMPLE  t1      range   i1      i1      4       NULL    3       Using where; Using index; Using join buffer
 
261
1       SIMPLE  t1      index   i1      i1      4       NULL    7       Using where; Using index; Using join buffer
262
262
DROP TABLE t1,t2;
263
263
CREATE TEMPORARY TABLE t1 (
264
264
a int default NULL,
489
489
1025    Y       25      1025    Y       25
490
490
1026    Z       26      1026    Z       26
491
491
drop table t1,t2;
492
 
create table t1 (x bigint not null);
 
492
create table t1 (x bigint unsigned not null);
493
493
insert into t1(x) values (0x0ffffffffffffff0);
494
494
insert into t1(x) values (0x0ffffffffffffff1);
495
495
select * from t1;
507
507
0
508
508
select count(*) from t1 where x < -16;
509
509
count(*)
510
 
0
 
510
1
511
511
select count(*) from t1 where x = -16;
512
512
count(*)
513
 
0
 
513
1
514
514
select count(*) from t1 where x > -16;
515
515
count(*)
516
 
2
 
516
0
517
517
select count(*) from t1 where x = 18446744073709551601;
518
518
count(*)
519
519
0
544
544
1
545
545
select count(*) from t2 where x = 18446744073709551601;
546
546
count(*)
547
 
1
 
547
0
548
548
drop table t1,t2;
549
549
create table t1 (x bigint not null primary key) engine=innodb;
550
550
insert into t1(x) values (0x0ffffffffffffff0);
575
575
count(*)
576
576
0
577
577
drop table t1;
578
 
create table t1 (a bigint);
 
578
create table t1 (a bigint unsigned);
 
579
show create table t1;
 
580
Table   Create Table
 
581
t1      CREATE TABLE `t1` (
 
582
  `a` BIGINT UNSIGNED DEFAULT NULL
 
583
) ENGINE=InnoDB COLLATE = utf8_general_ci
579
584
create index t1i on t1(a);
 
585
show create table t1;
 
586
Table   Create Table
 
587
t1      CREATE TABLE `t1` (
 
588
  `a` BIGINT UNSIGNED DEFAULT NULL,
 
589
  KEY `t1i` (`a`)
 
590
) ENGINE=InnoDB COLLATE = utf8_general_ci
 
591
insert into t1 values (9223372036854775807);
 
592
truncate t1;
580
593
insert into t1 select 18446744073709551615;
581
594
insert into t1 select 18446744073709551614;
582
595
explain select * from t1 where a <> -1;
584
597
1       SIMPLE  t1      index   t1i     t1i     9       NULL    2       Using where; Using index
585
598
select * from t1 where a <> -1;
586
599
a
587
 
-2
 
600
-1
588
601
explain select * from t1 where a > -1 or a < -1;
589
602
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
590
603
1       SIMPLE  t1      index   t1i     t1i     9       NULL    2       Using where; Using index
644
657
filler char(82),
645
658
PRIMARY KEY (pk1,pk2,pk3,pk4)
646
659
);
647
 
insert into t2 select 1, A.a+10*B.a, 432, 44, 'fillerZ' from t1 A, t1 B;
 
660
insert into t2 select 1, A.a+10*B.a, 432, 44, 'fillerZ' from t1 A CROSS JOIN t1 B;
648
661
INSERT INTO t2 VALUES (2621, 2635, 0, 0,'filler'), (2621, 2635, 1, 0,'filler'),
649
662
(2621, 2635, 10, 0,'filler'), (2621, 2635, 11, 0,'filler'),
650
663
(2621, 2635, 14, 0,'filler'), (2621, 2635, 1000015, 0,'filler');
659
672
insert into t1 values ('x'), ('xx');
660
673
explain select a from t1 where a > 'x';
661
674
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
662
 
1       SIMPLE  t1      range   a       a       7       NULL    1       Using where
 
675
1       SIMPLE  t1      range   a       a       7       NULL    2       Using where
663
676
select a from t1 where a > 'x';
664
677
a
665
678
xx
868
881
(55,'C'), (56,'C'), (57,'C'), (58,'C'), (59,'C'), (60,'C');
869
882
EXPLAIN SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B';
870
883
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
871
 
1       SIMPLE  t1      range   status  status  83      NULL    28      Using where; Using index
 
884
1       SIMPLE  t1      range   status  status  83      NULL    10      Using where; Using index
872
885
EXPLAIN SELECT * FROM t1 WHERE status NOT IN ('A','B');
873
886
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
874
 
1       SIMPLE  t1      range   status  status  83      NULL    28      Using where; Using index
 
887
1       SIMPLE  t1      range   status  status  83      NULL    10      Using where; Using index
875
888
SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B';
876
889
id      status
877
890
53      C
894
907
60      C
895
908
EXPLAIN SELECT status FROM t1 WHERE status <> 'A' AND status <> 'B';
896
909
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
897
 
1       SIMPLE  t1      range   status  status  83      NULL    28      Using where; Using index
 
910
1       SIMPLE  t1      range   status  status  83      NULL    10      Using where; Using index
898
911
EXPLAIN SELECT status FROM t1 WHERE status NOT IN ('A','B');
899
912
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
900
 
1       SIMPLE  t1      range   status  status  83      NULL    28      Using where; Using index
 
913
1       SIMPLE  t1      range   status  status  83      NULL    10      Using where; Using index
901
914
EXPLAIN SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B';
902
915
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
903
 
1       SIMPLE  t1      range   status  status  83      NULL    18      Using where; Using index
 
916
1       SIMPLE  t1      range   status  status  83      NULL    9       Using where; Using index
904
917
EXPLAIN SELECT * FROM t1 WHERE status < 'A' OR status > 'B';
905
918
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
906
 
1       SIMPLE  t1      range   status  status  83      NULL    18      Using where; Using index
 
919
1       SIMPLE  t1      range   status  status  83      NULL    9       Using where; Using index
907
920
SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B';
908
921
id      status
909
922
53      C
956
969
insert into t1 values ('a ','');
957
970
insert into t1 values ('a  ', '');
958
971
insert into t1 select concat('a', 1000 + A.a + 10 * (B.a + 10 * C.a)), ''
959
 
  from t3 A, t3 B, t3 C;
 
972
  from t3 A CROSS JOIN t3 B CROSS JOIN t3 C;
960
973
create table t2 (a varchar(10), filler char(200), key(a));
961
974
insert into t2 select * from t1;
962
975
explain select * from t1 where a between 'a' and 'a ';