mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			77 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
create table t1 (a int) engine=innodb partition by hash(a) ;
 | 
						|
show table status like 't1';
 | 
						|
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
 | 
						|
t1	InnoDB	10	Compact	2	8192	16384	0	0	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL	partitioned	
 | 
						|
drop table t1;
 | 
						|
create table t1 (a int)
 | 
						|
engine = innodb
 | 
						|
partition by key (a);
 | 
						|
show table status;
 | 
						|
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
 | 
						|
t1	InnoDB	10	Compact	2	8192	16384	0	0	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL	partitioned	
 | 
						|
insert into t1 values (0), (1), (2), (3);
 | 
						|
show table status;
 | 
						|
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
 | 
						|
t1	InnoDB	10	Compact	4	4096	16384	0	0	0	NULL	NULL	NULL	NULL	latin1_swedish_ci	NULL	partitioned	
 | 
						|
drop table t1;
 | 
						|
create table t1 (a int auto_increment primary key)
 | 
						|
engine = innodb
 | 
						|
partition by key (a);
 | 
						|
show table status;
 | 
						|
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
 | 
						|
t1	InnoDB	10	Compact	2	8192	16384	0	0	0	1	NULL	NULL	NULL	latin1_swedish_ci	NULL	partitioned	
 | 
						|
insert into t1 values (NULL), (NULL), (NULL), (NULL);
 | 
						|
show table status;
 | 
						|
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
 | 
						|
t1	InnoDB	10	Compact	4	4096	16384	0	0	0	5	NULL	NULL	NULL	latin1_swedish_ci	NULL	partitioned	
 | 
						|
insert into t1 values (NULL), (NULL), (NULL), (NULL);
 | 
						|
show table status;
 | 
						|
Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
 | 
						|
t1	InnoDB	10	Compact	8	2048	16384	0	0	0	9	NULL	NULL	NULL	latin1_swedish_ci	NULL	partitioned	
 | 
						|
drop table t1;
 | 
						|
create table t1 (a int)
 | 
						|
partition by key (a)
 | 
						|
(partition p1 engine = innodb);
 | 
						|
alter table t1 rebuild partition p1;
 | 
						|
alter table t1 rebuild partition p1;
 | 
						|
alter table t1 rebuild partition p1;
 | 
						|
alter table t1 rebuild partition p1;
 | 
						|
alter table t1 rebuild partition p1;
 | 
						|
alter table t1 rebuild partition p1;
 | 
						|
alter table t1 rebuild partition p1;
 | 
						|
drop table t1;
 | 
						|
create table t1 (a date)
 | 
						|
engine = innodb
 | 
						|
partition by range (year(a))
 | 
						|
(partition p0 values less than (2006),
 | 
						|
partition p1 values less than (2007));
 | 
						|
explain partitions select * from t1
 | 
						|
where a between '2006-01-01' and '2007-06-01';
 | 
						|
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 | 
						|
1	SIMPLE	t1	p1	ALL	NULL	NULL	NULL	NULL	2	Using where
 | 
						|
drop table t1;
 | 
						|
create table t1 (a int)
 | 
						|
engine = x
 | 
						|
partition by key (a);
 | 
						|
Warnings:
 | 
						|
Error	1286	Unknown table engine 'x'
 | 
						|
show create table t1;
 | 
						|
Table	Create Table
 | 
						|
t1	CREATE TABLE `t1` (
 | 
						|
  `a` int(11) DEFAULT NULL
 | 
						|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a)  */
 | 
						|
drop table t1;
 | 
						|
create table t1 (a int)
 | 
						|
engine = innodb
 | 
						|
partition by list (a)
 | 
						|
(partition p0 values in (0));
 | 
						|
alter table t1 engine = x;
 | 
						|
Warnings:
 | 
						|
Error	1286	Unknown table engine 'x'
 | 
						|
show create table t1;
 | 
						|
Table	Create Table
 | 
						|
t1	CREATE TABLE `t1` (
 | 
						|
  `a` int(11) DEFAULT NULL
 | 
						|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */
 | 
						|
drop table t1;
 |