information_schema.global_status where variable_name like "Maria_pagecache_read%";
information_schema.global_status where variable_name like "Maria_pagecache_reads";
create table t1 (
create table t1 (
a int not null auto_increment,
a int not null auto_increment,
b char(16) not null,
b char(16) not null,
...
@@ -51,21 +52,18 @@ flush tables;
...
@@ -51,21 +52,18 @@ flush tables;
flush status;
flush status;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 211644
MARIA_PAGECACHE_READS 3
MARIA_PAGECACHE_READS 3
select count(*) from t1 where b = 'test1';
select count(*) from t1 where b = 'test1';
count(*)
count(*)
4181
4181
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 211926
MARIA_PAGECACHE_READS 11
MARIA_PAGECACHE_READS 11
select count(*) from t1 where b = 'test1';
select count(*) from t1 where b = 'test1';
count(*)
count(*)
4181
4181
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 212208
MARIA_PAGECACHE_READS 12
MARIA_PAGECACHE_READS 12
flush tables;
flush tables;
flush status;
flush status;
...
@@ -77,20 +75,17 @@ Table Op Msg_type Msg_text
...
@@ -77,20 +75,17 @@ Table Op Msg_type Msg_text
test.t1 preload_keys status OK
test.t1 preload_keys status OK
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 212535
MARIA_PAGECACHE_READS 84
MARIA_PAGECACHE_READS 84
select count(*) from t1 where b = 'test1';
select count(*) from t1 where b = 'test1';
count(*)
count(*)
4181
4181
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 212817
MARIA_PAGECACHE_READS 85
MARIA_PAGECACHE_READS 85
flush tables;
flush tables;
flush status;
flush status;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 213073
MARIA_PAGECACHE_READS 86
MARIA_PAGECACHE_READS 86
set session preload_buffer_size=256*1024;
set session preload_buffer_size=256*1024;
select @@preload_buffer_size;
select @@preload_buffer_size;
...
@@ -101,20 +96,17 @@ Table Op Msg_type Msg_text
...
@@ -101,20 +96,17 @@ Table Op Msg_type Msg_text
test.t1 preload_keys status OK
test.t1 preload_keys status OK
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 213400
MARIA_PAGECACHE_READS 158
MARIA_PAGECACHE_READS 158
select count(*) from t1 where b = 'test1';
select count(*) from t1 where b = 'test1';
count(*)
count(*)
4181
4181
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 213682
MARIA_PAGECACHE_READS 165
MARIA_PAGECACHE_READS 165
flush tables;
flush tables;
flush status;
flush status;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 213938
MARIA_PAGECACHE_READS 166
MARIA_PAGECACHE_READS 166
set session preload_buffer_size=1*1024;
set session preload_buffer_size=1*1024;
select @@preload_buffer_size;
select @@preload_buffer_size;
...
@@ -126,7 +118,6 @@ test.t1 preload_keys status OK
...
@@ -126,7 +118,6 @@ test.t1 preload_keys status OK
test.t2 preload_keys status OK
test.t2 preload_keys status OK
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 214308
MARIA_PAGECACHE_READS 281
MARIA_PAGECACHE_READS 281
select count(*) from t1 where b = 'test1';
select count(*) from t1 where b = 'test1';
count(*)
count(*)
...
@@ -136,13 +127,11 @@ count(*)
...
@@ -136,13 +127,11 @@ count(*)
2584
2584
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 214604
MARIA_PAGECACHE_READS 285
MARIA_PAGECACHE_READS 285
flush tables;
flush tables;
flush status;
flush status;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
variable_name g.variable_value-i.variable_value
variable_name g.variable_value-i.variable_value
MARIA_PAGECACHE_READ_REQUESTS 215159
MARIA_PAGECACHE_READS 330
MARIA_PAGECACHE_READS 330
flush tables;
flush tables;
flush status;
flush status;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
select g.variable_name,g.variable_value-i.variable_value from information_schema.global_status as g,initial as i where g.variable_name like "Maria_pagecache_read%" and g.variable_name=i.variable_name order by g.variable_name desc;
create table t1 (a int not null, key key_block_size=1024 (a));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=1024 (a))' at line 1
create table t1 (a int not null, key `a` key_block_size=1024 (a));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_block_size=1024 (a))' at line 1
CREATE TABLE t1 (
c1 INT,
c2 VARCHAR(300),
KEY (c1) KEY_BLOCK_SIZE 1024,
KEY (c2) KEY_BLOCK_SIZE 8192
);
INSERT INTO t1 VALUES (10, REPEAT('a', CEIL(RAND(10) * 300))),
INSERT INTO `t1` VALUES ('bla',1000),('bla',1001),('bla',1002);
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
unlock tables;
create table t2 like t1;
insert into t2 select * from t1;
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status Table is already up to date
delete from t2;
insert into t2 select * from t1;
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status Table is already up to date
drop table t1,t2;
create table t1 (a bigint auto_increment, primary key(a), b char(255), c varchar(20000));
update t1 set b=repeat('a',100) where a between 1 and 100;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
update t1 set c=repeat('a',8192*2) where a between 200 and 202;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
CREATE TABLE t1 (a int, b int, v varchar(60000)) checksum=1 engine=maria;
insert into t1 values (1,1,"aaa"),(1,2,null);
checksum table t1;
Table Checksum
test.t1 1112804611
lock table t1 write;
insert into t1 values (1,3,repeat('c',30000)),(4,4,repeat('a',30000));
update t1 set v="row5" where b=4;
delete from t1 where b=3;
select a, b, length(v) from t1;
a b length(v)
1 1 3
1 2 NULL
4 4 4
drop table t1;
CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
string char(10) default "hello",
tiny tinyint(4) DEFAULT '0' NOT NULL ,
short smallint(6) DEFAULT '1' NOT NULL ,
medium mediumint(8) DEFAULT '0' NOT NULL,
long_int int(11) DEFAULT '0' NOT NULL,
longlong bigint(13) DEFAULT '0' NOT NULL,
real_float float(13,1) DEFAULT 0.0 NOT NULL,
real_double double(16,4),
utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
ulong int(11) unsigned DEFAULT '0' NOT NULL,
ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
time_stamp timestamp,
date_field date,
time_field time,
date_time datetime,
blob_col blob,
tinyblob_col tinyblob,
mediumblob_col mediumblob not null default '',
longblob_col longblob not null default '',
options enum('one','two','tree') not null ,
flags set('one','two','tree') not null default '',
PRIMARY KEY (auto),
KEY (utiny),
KEY (tiny),
KEY (short),
KEY any_name (medium),
KEY (longlong),
KEY (real_float),
KEY (ushort),
KEY (umedium),
KEY (ulong),
KEY (ulonglong,ulong),
KEY (options,flags)
) engine=maria;
insert into t1 values (10,1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
create table t2 (primary key (auto)) engine=maria row_format=page select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
check table t1,t2;
Table Op Msg_type Msg_text
test.t1 check status OK
test.t2 check status OK
select t1,t2,length(t3),length(t4),length(t5),length(t6),t7,t8 from t2;
create table t2 (primary key (auto)) engine=maria row_format=dynamic select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
check table t2;
Table Op Msg_type Msg_text
test.t2 check status OK
drop table t1,t2;
CREATE TABLE t1 (seq int, s1 int, s2 blob);
insert into t1 values (1, 1, MD5(1));
update t1 set s1=2 where seq=1;
check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
show variables like 'maria%';
Variable_name Value
maria_block_size 8192
maria_checkpoint_interval 30
maria_force_start_after_recovery_failures 0
maria_log_file_size 4294959104
maria_log_purge_type immediate
maria_max_sort_file_size 9223372036854775807
maria_page_checksum OFF
maria_pagecache_age_threshold 300
maria_pagecache_buffer_size 8388600
maria_pagecache_division_limit 100
maria_recover OFF
maria_repair_threads 1
maria_sort_buffer_size 8388608
maria_stats_method nulls_unequal
maria_sync_log_dir NEWFILE
show status like 'maria%';
Variable_name Value
Maria_pagecache_blocks_not_flushed #
Maria_pagecache_blocks_unused #
Maria_pagecache_blocks_used #
Maria_pagecache_read_requests #
Maria_pagecache_reads #
Maria_pagecache_write_requests #
Maria_pagecache_writes #
create table t1 (b char(0));
insert into t1 values(NULL),("");
select length(b) from t1;
length(b)
NULL
0
alter table t1 add column c char(0), add key (c);
insert into t1 values("",""),("",NULL);
select length(b),length(c) from t1;
length(b) length(c)
NULL NULL
0 NULL
0 0
0 NULL
select length(b),length(c) from t1 where c is null;
length(b) length(c)
NULL NULL
0 NULL
0 NULL
select length(b),length(c) from t1 where c is not null;
length(b) length(c)
0 0
select length(b),length(c) from t1 order by c;
length(b) length(c)
NULL NULL
0 NULL
0 NULL
0 0
alter table t1 add column d char(0) not null, add key (d);
ERROR 42000: The used storage engine can't index column 'd'
drop table t1;
CREATE TABLE t1 (a bit(3));
insert into t1 values (NULL),(0),(1),(2),(3),(4),(5),(6),(7);
create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
drop table t1, t2, t3;
create table t1 (t datetime) engine=maria;
insert into t1 values (101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030100000000),(20030000000000);
select * from t1;
t
2000-01-01 00:00:00
2069-12-31 00:00:00
1970-01-01 00:00:00
1999-12-31 00:00:00
1000-01-01 00:00:00
9999-12-31 00:00:00
2000-01-01 00:00:00
2069-12-31 00:00:00
1970-01-01 00:00:00
1999-12-31 23:59:59
1000-01-01 00:00:00
9999-12-31 23:59:59
2003-01-00 00:00:00
2003-00-00 00:00:00
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
delete from t1 where t > 0;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
CREATE TABLE t1 (id int(11) PRIMARY KEY auto_increment,f1 varchar(10) NOT NULL UNIQUE);
INSERT IGNORE INTO t1 (f1) VALUES ("test1");
INSERT IGNORE INTO t1 (f1) VALUES ("test1");
INSERT IGNORE INTO t1 (f1) VALUES ("test2");
SELECT * FROM t1;
id f1
1 test1
2 test2
drop table t1;
SET SQL_MODE = 'TRADITIONAL';
create table t1 (n int not null primary key auto_increment, c char(1), unique(c));
insert into t1 values(100, "a");
insert into t1 values(300, "b");
insert into t1 values(50, "a");
ERROR 23000: Duplicate entry 'a' for key 'c'
insert into t1 values(null, "c");
select * from t1;
n c
100 a
300 b
301 c
update t1 set n=400,c='a' where n=301;
ERROR 23000: Duplicate entry 'a' for key 'c'
insert into t1 values(null, "d");
select * from t1;
n c
100 a
300 b
301 c
302 d
drop table t1;
create table t1 (n int not null primary key auto_increment, c char(1), unique(c)) transactional=0 row_format=dynamic;
insert into t1 values(100, "a");
insert into t1 values(300, "b");
insert into t1 values(50, "a");
ERROR 23000: Duplicate entry 'a' for key 'c'
insert into t1 values(null, "c");
select * from t1;
n c
100 a
300 b
301 c
update t1 set n=400,c='a' where n=301;
ERROR 23000: Duplicate entry 'a' for key 'c'
insert into t1 values(null, "d");
select * from t1;
n c
100 a
300 b
301 c
302 d
drop table t1;
create table t1 (n int not null, c char(1)) engine=maria;
create table t1 (a int not null, key key_block_size=1024 (a));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=1024 (a))' at line 1
create table t1 (a int not null, key `a` key_block_size=1024 (a));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_block_size=1024 (a))' at line 1
CREATE TABLE t1 (
c1 INT,
c2 VARCHAR(300),
KEY (c1) KEY_BLOCK_SIZE 1024,
KEY (c2) KEY_BLOCK_SIZE 8192
);
INSERT INTO t1 VALUES (10, REPEAT('a', CEIL(RAND(10) * 300))),
INSERT INTO `t1` VALUES ('bla',1000),('bla',1001),('bla',1002);
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
unlock tables;
create table t2 like t1;
insert into t2 select * from t1;
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status Table is already up to date
delete from t2;
insert into t2 select * from t1;
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status Table is already up to date
drop table t1,t2;
create table t1 (a bigint auto_increment, primary key(a), b char(255), c varchar(20000));
update t1 set b=repeat('a',100) where a between 1 and 100;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
update t1 set c=repeat('a',8192*2) where a between 200 and 202;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
CREATE TABLE t1 (a int, b int, v varchar(60000)) checksum=1 engine=maria;
insert into t1 values (1,1,"aaa"),(1,2,null);
checksum table t1;
Table Checksum
test.t1 1112804611
lock table t1 write;
insert into t1 values (1,3,repeat('c',30000)),(4,4,repeat('a',30000));
update t1 set v="row5" where b=4;
delete from t1 where b=3;
select a, b, length(v) from t1;
a b length(v)
1 1 3
1 2 NULL
4 4 4
drop table t1;
CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
string char(10) default "hello",
tiny tinyint(4) DEFAULT '0' NOT NULL ,
short smallint(6) DEFAULT '1' NOT NULL ,
medium mediumint(8) DEFAULT '0' NOT NULL,
long_int int(11) DEFAULT '0' NOT NULL,
longlong bigint(13) DEFAULT '0' NOT NULL,
real_float float(13,1) DEFAULT 0.0 NOT NULL,
real_double double(16,4),
utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
ulong int(11) unsigned DEFAULT '0' NOT NULL,
ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
time_stamp timestamp,
date_field date,
time_field time,
date_time datetime,
blob_col blob,
tinyblob_col tinyblob,
mediumblob_col mediumblob not null default '',
longblob_col longblob not null default '',
options enum('one','two','tree') not null ,
flags set('one','two','tree') not null default '',
PRIMARY KEY (auto),
KEY (utiny),
KEY (tiny),
KEY (short),
KEY any_name (medium),
KEY (longlong),
KEY (real_float),
KEY (ushort),
KEY (umedium),
KEY (ulong),
KEY (ulonglong,ulong),
KEY (options,flags)
) engine=maria;
insert into t1 values (10,1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
create table t2 (primary key (auto)) engine=maria row_format=page select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
check table t1,t2;
Table Op Msg_type Msg_text
test.t1 check status OK
test.t2 check status OK
select t1,t2,length(t3),length(t4),length(t5),length(t6),t7,t8 from t2;
create table t2 (primary key (auto)) engine=maria row_format=dynamic select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
check table t2;
Table Op Msg_type Msg_text
test.t2 check status OK
drop table t1,t2;
CREATE TABLE t1 (seq int, s1 int, s2 blob);
insert into t1 values (1, 1, MD5(1));
update t1 set s1=2 where seq=1;
check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
show variables like 'maria%';
Variable_name Value
maria_block_size 8192
maria_checkpoint_interval 30
maria_force_start_after_recovery_failures 0
maria_log_file_size 4294959104
maria_log_purge_type immediate
maria_max_sort_file_size 9223372036854775807
maria_page_checksum OFF
maria_pagecache_age_threshold 300
maria_pagecache_buffer_size 8388600
maria_pagecache_division_limit 100
maria_recover OFF
maria_repair_threads 1
maria_sort_buffer_size 8388608
maria_stats_method nulls_unequal
maria_sync_log_dir NEWFILE
show status like 'maria%';
Variable_name Value
Maria_pagecache_blocks_not_flushed #
Maria_pagecache_blocks_unused #
Maria_pagecache_blocks_used #
Maria_pagecache_read_requests #
Maria_pagecache_reads #
Maria_pagecache_write_requests #
Maria_pagecache_writes #
create table t1 (b char(0));
insert into t1 values(NULL),("");
select length(b) from t1;
length(b)
NULL
0
alter table t1 add column c char(0), add key (c);
insert into t1 values("",""),("",NULL);
select length(b),length(c) from t1;
length(b) length(c)
NULL NULL
0 NULL
0 0
0 NULL
select length(b),length(c) from t1 where c is null;
length(b) length(c)
NULL NULL
0 NULL
0 NULL
select length(b),length(c) from t1 where c is not null;
length(b) length(c)
0 0
select length(b),length(c) from t1 order by c;
length(b) length(c)
NULL NULL
0 NULL
0 NULL
0 0
alter table t1 add column d char(0) not null, add key (d);
ERROR 42000: The used storage engine can't index column 'd'
drop table t1;
CREATE TABLE t1 (a bit(3));
insert into t1 values (NULL),(0),(1),(2),(3),(4),(5),(6),(7);
create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
drop table t1, t2, t3;
create table t1 (t datetime) engine=maria;
insert into t1 values (101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030100000000),(20030000000000);
select * from t1;
t
2000-01-01 00:00:00
2069-12-31 00:00:00
1970-01-01 00:00:00
1999-12-31 00:00:00
1000-01-01 00:00:00
9999-12-31 00:00:00
2000-01-01 00:00:00
2069-12-31 00:00:00
1970-01-01 00:00:00
1999-12-31 23:59:59
1000-01-01 00:00:00
9999-12-31 23:59:59
2003-01-00 00:00:00
2003-00-00 00:00:00
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
delete from t1 where t > 0;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
CREATE TABLE t1 (id int(11) PRIMARY KEY auto_increment,f1 varchar(10) NOT NULL UNIQUE);
INSERT IGNORE INTO t1 (f1) VALUES ("test1");
INSERT IGNORE INTO t1 (f1) VALUES ("test1");
INSERT IGNORE INTO t1 (f1) VALUES ("test2");
SELECT * FROM t1;
id f1
1 test1
2 test2
drop table t1;
SET SQL_MODE = 'TRADITIONAL';
create table t1 (n int not null primary key auto_increment, c char(1), unique(c));
insert into t1 values(100, "a");
insert into t1 values(300, "b");
insert into t1 values(50, "a");
ERROR 23000: Duplicate entry 'a' for key 'c'
insert into t1 values(null, "c");
select * from t1;
n c
100 a
300 b
301 c
update t1 set n=400,c='a' where n=301;
ERROR 23000: Duplicate entry 'a' for key 'c'
insert into t1 values(null, "d");
select * from t1;
n c
100 a
300 b
301 c
302 d
drop table t1;
create table t1 (n int not null primary key auto_increment, c char(1), unique(c)) transactional=0 row_format=dynamic;
insert into t1 values(100, "a");
insert into t1 values(300, "b");
insert into t1 values(50, "a");
ERROR 23000: Duplicate entry 'a' for key 'c'
insert into t1 values(null, "c");
select * from t1;
n c
100 a
300 b
301 c
update t1 set n=400,c='a' where n=301;
ERROR 23000: Duplicate entry 'a' for key 'c'
insert into t1 values(null, "d");
select * from t1;
n c
100 a
300 b
301 c
302 d
drop table t1;
create table t1 (n int not null, c char(1)) engine=maria;