mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	bmove_allign -> bmove_align Added OLAP function ROLLUP Split mysql_fix_privilege_tables to a script and a .sql data file Added new (MEMROOT*) functions to avoid calling current_thd() when creating some common objects. Added table_alias_charset, for easier --lower-case-table-name handling Better SQL_MODE handling (Setting complex options also sets sub options) New (faster) assembler string functions for x86
		
			
				
	
	
		
			34 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
drop table if exists t1,t2;
 | 
						|
create table t1 (i int, j int, empty_string char(10), bool char(1), d date);
 | 
						|
insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6,"","Y","2002-03-04"), (7,8,"","N","2002-03-05");
 | 
						|
select count(*) from t1 procedure analyse();
 | 
						|
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
 | 
						|
count(*)	4	4	1	1	0	0	4.0000	0.0000	ENUM('4') NOT NULL
 | 
						|
select * from t1 procedure analyse();
 | 
						|
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
 | 
						|
test.t1.i	1	7	1	1	0	0	4.0000	2.2361	ENUM('1','3','5','7') NOT NULL
 | 
						|
test.t1.j	2	8	1	1	0	0	5.0000	2.2361	ENUM('2','4','6','8') NOT NULL
 | 
						|
test.t1.empty_string			0	0	4	0	0.0000	NULL	CHAR(0) NOT NULL
 | 
						|
test.t1.bool	N	Y	1	1	0	0	1.0000	NULL	ENUM('N','Y') NOT NULL
 | 
						|
test.t1.d	2002-03-03	2002-03-05	10	10	0	0	10.0000	NULL	ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
 | 
						|
select * from t1 procedure analyse(2);
 | 
						|
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
 | 
						|
test.t1.i	1	7	1	1	0	0	4.0000	2.2361	TINYINT(1) UNSIGNED NOT NULL
 | 
						|
test.t1.j	2	8	1	1	0	0	5.0000	2.2361	TINYINT(1) UNSIGNED NOT NULL
 | 
						|
test.t1.empty_string			0	0	4	0	0.0000	NULL	CHAR(0) NOT NULL
 | 
						|
test.t1.bool	N	Y	1	1	0	0	1.0000	NULL	ENUM('N','Y') NOT NULL
 | 
						|
test.t1.d	2002-03-03	2002-03-05	10	10	0	0	10.0000	NULL	ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
 | 
						|
create table t2 select * from t1 procedure analyse();
 | 
						|
select * from t2;
 | 
						|
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
 | 
						|
test.t1.i	1	7	1	1	0	0	4.0000	2.2361	ENUM('1','3','5','7') NOT NULL
 | 
						|
test.t1.j	2	8	1	1	0	0	5.0000	2.2361	ENUM('2','4','6','8') NOT NULL
 | 
						|
test.t1.empty_string			0	0	4	0	0.0000	NULL	CHAR(0) NOT NULL
 | 
						|
test.t1.bool	N	Y	1	1	0	0	1.0000	NULL	ENUM('N','Y') NOT NULL
 | 
						|
test.t1.d	2002-03-03	2002-03-05	10	10	0	0	10.0000	NULL	ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
 | 
						|
drop table t1,t2;
 | 
						|
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
 | 
						|
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 | 
						|
1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	1	
 | 
						|
2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 |