mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 15:50:51 +03:00 
			
		
		
		
	 187b01a45f
			
		
	
	187b01a45f
	
	
	
		
			
			Issuing SELECT COUNT(*) against partitioned InnoDB table may cause server crash. Fixed that not all required fields were included into read_set.
		
			
				
	
	
		
			139 lines
		
	
	
		
			6.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			139 lines
		
	
	
		
			6.8 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:
 | |
| Warning	1286	Unknown table engine 'x'
 | |
| Warning	1266	Using storage engine MyISAM for table 't1'
 | |
| 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:
 | |
| Warning	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;
 | |
| create table t1
 | |
| (
 | |
| id int unsigned auto_increment,
 | |
| time datetime not null,
 | |
| first_name varchar(40),
 | |
| last_name varchar(50),
 | |
| primary key (id, time),
 | |
| index first_index (first_name),
 | |
| index last_index (last_name)	
 | |
| ) engine=Innodb partition by range (to_days(time)) (
 | |
| partition p1 values less than (to_days('2007-02-07')),
 | |
| partition p2 values less than (to_days('2007-02-08')),
 | |
| partition p3 values less than MAXVALUE
 | |
| );
 | |
| insert into t1 (time, first_name, last_name) values ('2007-02-07', 'Q', 'Robert'),
 | |
| ('2007-02-07', 'Mark', 'Nate'), ('2007-02-07', 'Nate', 'Oscar'),
 | |
| ('2007-02-07', 'Zack', 'Alice'), ('2007-02-07', 'Jack', 'Kathy'),
 | |
| ('2007-02-06', 'Alice', 'Alice'), ('2007-02-06', 'Brian', 'Charles'),
 | |
| ('2007-02-06', 'Charles', 'David'), ('2007-02-06', 'David', 'Eric'),
 | |
| ('2007-02-07', 'Hector', 'Isaac'), ('2007-02-07', 'Oscar', 'Patricia'),
 | |
| ('2007-02-07', 'Patricia', 'Q'), ('2007-02-07', 'X', 'Yuri'),
 | |
| ('2007-02-07', 'Robert', 'Shawn'), ('2007-02-07', 'Kathy', 'Lois'),
 | |
| ('2007-02-07', 'Eric', 'Francis'), ('2007-02-06', 'Shawn', 'Theron'),
 | |
| ('2007-02-06', 'U', 'Vincent'), ('2007-02-06', 'Francis', 'George'),
 | |
| ('2007-02-06', 'George', 'Hector'), ('2007-02-06', 'Vincent', 'Walter'),
 | |
| ('2007-02-06', 'Walter', 'X'), ('2007-02-07', 'Lois', 'Mark'),
 | |
| ('2007-02-07', 'Yuri', 'Zack'), ('2007-02-07', 'Isaac', 'Jack'),
 | |
| ('2007-02-07', 'Sharon', 'Mark'), ('2007-02-07', 'Michael', 'Michelle'),
 | |
| ('2007-02-07', 'Derick', 'Nathan'), ('2007-02-07', 'Peter', 'Xavier'),
 | |
| ('2007-02-07', 'Fred', 'Harold'), ('2007-02-07', 'Katherine', 'Lisa'),
 | |
| ('2007-02-07', 'Tom', 'Rina'), ('2007-02-07', 'Jerry', 'Victor'),
 | |
| ('2007-02-07', 'Alexander', 'Terry'), ('2007-02-07', 'Justin', 'John'),
 | |
| ('2007-02-07', 'Greg', 'Ernest'), ('2007-02-07', 'Robert', 'Q'),
 | |
| ('2007-02-07', 'Nate', 'Mark'), ('2007-02-07', 'Oscar', 'Nate'),
 | |
| ('2007-02-07', 'Alice', 'Zack'), ('2007-02-07', 'Kathy', 'Jack'),
 | |
| ('2007-02-06', 'Alice', 'Alice'), ('2007-02-06', 'Charles', 'Brian'),
 | |
| ('2007-02-06', 'David', 'Charles'), ('2007-02-06', 'Eric', 'David'),
 | |
| ('2007-02-07', 'Isaac', 'Hector'), ('2007-02-07', 'Patricia', 'Oscar'),
 | |
| ('2007-02-07', 'Q', 'Patricia'), ('2007-02-07', 'Yuri', 'X'),
 | |
| ('2007-02-07', 'Shawn', 'Robert'), ('2007-02-07', 'Lois', 'Kathy'),
 | |
| ('2007-02-07', 'Francis', 'Eric'), ('2007-02-06', 'Theron', 'Shawn'),
 | |
| ('2007-02-06', 'Vincent', 'U'), ('2007-02-06', 'George', 'Francis'),
 | |
| ('2007-02-06', 'Hector', 'George'), ('2007-02-06', 'Walter', 'Vincent'),
 | |
| ('2007-02-06', 'X', 'Walter'), ('2007-02-07', 'Mark', 'Lois'),
 | |
| ('2007-02-07', 'Zack', 'Yuri'), ('2007-02-07', 'Jack', 'Isaac'),
 | |
| ('2007-02-07', 'Mark', 'Sharon'), ('2007-02-07', 'Michelle', 'Michael'),
 | |
| ('2007-02-07', 'Nathan', 'Derick'), ('2007-02-07', 'Xavier', 'Peter'),
 | |
| ('2007-02-07', 'Harold', 'Fred'), ('2007-02-07', 'Lisa', 'Katherine'),
 | |
| ('2007-02-07', 'Rina', 'Tom'), ('2007-02-07', 'Victor', 'Jerry'),
 | |
| ('2007-02-07', 'Terry', 'Alexander'), ('2007-02-07', 'John', 'Justin'),
 | |
| ('2007-02-07', 'Ernest', 'Greg');
 | |
| SELECT * FROM t1 WHERE first_name='Andy' OR last_name='Jake';
 | |
| id	time	first_name	last_name
 | |
| drop table t1;
 | |
| CREATE TABLE t1 (a DOUBLE NOT NULL, KEY(a)) ENGINE=InnoDB
 | |
| PARTITION BY KEY(a) PARTITIONS 10;
 | |
| INSERT INTO t1 VALUES(1),(2);
 | |
| SELECT COUNT(*) FROM t1;
 | |
| COUNT(*)
 | |
| 2
 | |
| DROP TABLE t1;
 |