1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
drop table if exists t1;
create table t1 (
a int not null,
b text not null,
c int not null,
d blob,
e int not null,
primary key (a, c),
unique key (c, e)
)
engine=ndb
partition by range (c)
partitions 3
( partition p1 values less than (2),
partition p2 values less than (3),
partition p3 values less than (4));
insert into t1 values (1, @x1, 1, @x2, 1);
insert into t1 values (1, @y1, 2, @y2, 1);
insert into t1 values (1, @z1, 3, @z2, 1);
insert into t1 values (2, @x1, 1, @x2, 2);
insert into t1 values (2, @y1, 2, @y2, 2);
insert into t1 values (2, @z1, 3, @z2, 2);
insert into t1 values (3, @x1, 1, @x2, 3);
insert into t1 values (3, @y1, 2, @y2, 3);
insert into t1 values (3, @z1, 3, @z2, 3);
select a, c, sha1(b), sha1(d) from t1 order by a, c;
a c sha1(b) sha1(d)
1 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
1 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
1 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
2 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
2 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
2 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
3 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
3 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
3 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
select a, c, sha1(b), sha1(d) from t1 where a = 1 and c = 1;
a c sha1(b) sha1(d)
1 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
select a, c, sha1(b), sha1(d) from t1 where a = 1 and c = 2;
a c sha1(b) sha1(d)
1 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
select a, c, sha1(b), sha1(d) from t1 where a = 1 and c = 3;
a c sha1(b) sha1(d)
1 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
update t1 set b = @y1, d = @y2 where a = 2 and c = 1;
update t1 set b = @z1, d = @z2 where a = 2 and c = 2;
update t1 set b = @x1, d = @x2 where a = 2 and c = 3;
select a, c, sha1(b), sha1(d) from t1 order by a, c;
a c sha1(b) sha1(d)
1 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
1 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
1 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
2 1 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
2 2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
2 3 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
3 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
3 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
3 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
update t1 set b = @y1, d = @y2 where c = 1 and e = 3;
update t1 set b = @z1, d = @z2 where c = 2 and e = 3;
update t1 set b = @x1, d = @x2 where c = 3 and e = 3;
select a, c, sha1(b), sha1(d) from t1 order by a, c;
a c sha1(b) sha1(d)
1 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
1 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
1 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
2 1 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
2 2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
2 3 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
3 1 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
3 2 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
3 3 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
update t1 set b = @x1, d = @x2;
select a, c, sha1(b), sha1(d) from t1 order by a, c;
a c sha1(b) sha1(d)
1 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
1 2 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
1 3 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
2 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
2 2 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
2 3 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
3 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
3 2 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
3 3 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
update t1 set b = @x1, d = @x2 where c = 1;
update t1 set b = @y1, d = @y2 where c = 2;
update t1 set b = @z1, d = @z2 where c = 3;
select a, c, sha1(b), sha1(d) from t1 order by a, c;
a c sha1(b) sha1(d)
1 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
1 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
1 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
2 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
2 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
2 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
3 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
3 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
3 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
delete from t1 where a = 1 and c = 1;
select a, c, sha1(b), sha1(d) from t1 order by a, c;
a c sha1(b) sha1(d)
1 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
1 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
2 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
2 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
2 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
3 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
3 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
3 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
delete from t1 where c = 2 and e = 2;
select a, c, sha1(b), sha1(d) from t1 order by a, c;
a c sha1(b) sha1(d)
1 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
1 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
2 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
2 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
3 1 1d42dd9090cf78314a06665d4ea938c35cc760f4 10d3c783026b310218d10b7188da96a2401648c6
3 2 a33549d9844092289a58ac348dd59f09fc28406a daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
3 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
delete from t1 where c < 3;
select a, c, sha1(b), sha1(d) from t1 order by a, c;
a c sha1(b) sha1(d)
1 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
2 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
3 3 70fc9a7d08beebc522258bfb02000a30c77a8f1d 090565c580809efed3d369481a4bbb168b20713e
delete from t1;
select a, c, sha1(b), sha1(d) from t1 order by a, c;
a c sha1(b) sha1(d)
drop table t1;
create table t1 (
a char(4),
b int,
primary key (a, b)
)
engine=ndb
character set latin1
partition by key (a)
partitions 4;
insert into t1 values ('aaa',1);
insert into t1 values ('bbb',1);
insert into t1 values ('bbb',2);
select count(*) from t1 where a = 'aaa';
count(*)
1
select count(*) from t1 where a = 'Aaa';
count(*)
1
select count(*) from t1 where a = 'aAa';
count(*)
1
select count(*) from t1 where a = 'aaA';
count(*)
1
select count(*) from t1 where a = 'AAa';
count(*)
1
select count(*) from t1 where a = 'AaA';
count(*)
1
select count(*) from t1 where a = 'aAA';
count(*)
1
select count(*) from t1 where a = 'AAA';
count(*)
1
drop table t1;
create table t1 (
a varbinary(10),
b int,
primary key (a, b)
)
engine=ndb
character set latin1
partition by key (a)
partitions 4;
insert into t1 values ('aaa',1);
insert into t1 values ('aaabbb',1);
insert into t1 values ('aaabbb',2);
insert into t1 values ('aaabbbccc',1);
insert into t1 values ('aaabbbccc',2);
insert into t1 values ('aaabbbccc',3);
select count(*) from t1 where a = 'aaa';
count(*)
1
select count(*) from t1 where a = 'Aaa';
count(*)
0
select count(*) from t1 where a = 'aaabbb';
count(*)
2
select count(*) from t1 where a = 'aaaBbb';
count(*)
0
select count(*) from t1 where a = 'aaabbbccc';
count(*)
3
select count(*) from t1 where a = 'aaabbbCcc';
count(*)
0
drop table t1;
|