mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Some trivial optimzations
Check if AND/OR expression can be NULL; Fixed bug in GROUP BY and-or-expression where expression could be NULL Bug fix for SHOW OPEN TABLES when user didn't have privilege to access all open tables. Better fix for ALTER TABLE on BDB tables.
This commit is contained in:
@ -1,4 +1,11 @@
|
||||
drop table if exists t1;
|
||||
create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
|
||||
insert into t1 values(1, 't1',4,9);
|
||||
insert into t1 values(2, 'metatable',1,9);
|
||||
insert into t1 values(3, 'metaindex',1,9 );
|
||||
select * from t1;
|
||||
objid tablename oid test
|
||||
1 t1 4 9
|
||||
2 metatable 1 9
|
||||
3 metaindex 1 9
|
||||
alter table t1 drop column test;
|
||||
|
@ -1,4 +1,6 @@
|
||||
select * from t1;
|
||||
objid tablename oid
|
||||
1 t1 4
|
||||
2 metatable 1
|
||||
3 metaindex 1
|
||||
drop table t1;
|
||||
|
@ -92,7 +92,8 @@ NULL NULL NULL
|
||||
0 0
|
||||
select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
|
||||
grp count(*)
|
||||
0 7
|
||||
NULL 1
|
||||
0 6
|
||||
1 6
|
||||
SELECT DISTINCT FACILITY FROM t1;
|
||||
FACILITY
|
||||
|
@ -134,6 +134,6 @@ handler t2 read next;
|
||||
a b
|
||||
19 fff
|
||||
handler t2 read last;
|
||||
You have an error in your SQL syntax near '' at line 1
|
||||
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 '' at line 1
|
||||
handler t2 close;
|
||||
drop table if exists t1;
|
||||
|
@ -134,6 +134,6 @@ handler t2 read next;
|
||||
a b
|
||||
19 fff
|
||||
handler t2 read last;
|
||||
You have an error in your SQL syntax near '' at line 1
|
||||
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 '' at line 1
|
||||
handler t2 close;
|
||||
drop table if exists t1;
|
||||
|
@ -1718,7 +1718,7 @@ insert into tmp select * from t3;
|
||||
insert into t3 select * from tmp;
|
||||
alter table t3 add t2nr int not null auto_increment primary key first;
|
||||
drop table tmp;
|
||||
SET OPTION SQL_BIG_TABLES=1;
|
||||
SET SQL_BIG_TABLES=1;
|
||||
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
|
||||
namn
|
||||
Abraham Abraham
|
||||
@ -1731,7 +1731,7 @@ ammonium ammonium
|
||||
analyzable analyzable
|
||||
animals animals
|
||||
animized animized
|
||||
SET OPTION SQL_BIG_TABLES=0;
|
||||
SET SQL_BIG_TABLES=0;
|
||||
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
|
||||
concat(fld3," ",fld3)
|
||||
Abraham Abraham
|
||||
@ -1768,7 +1768,7 @@ attendants 1
|
||||
bedlam 1
|
||||
bedpost 1
|
||||
boasted 1
|
||||
SET OPTION SQL_BIG_TABLES=1;
|
||||
SET SQL_BIG_TABLES=1;
|
||||
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
|
||||
fld3 count(*)
|
||||
affixed 1
|
||||
@ -1781,7 +1781,7 @@ attendants 1
|
||||
bedlam 1
|
||||
bedpost 1
|
||||
boasted 1
|
||||
SET OPTION SQL_BIG_TABLES=0;
|
||||
SET SQL_BIG_TABLES=0;
|
||||
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
|
||||
fld3 repeat("a",length(fld3)) count(*)
|
||||
circus aaaaaa 1
|
||||
@ -1809,6 +1809,18 @@ explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
|
||||
t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
|
||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
|
||||
t3 ref period period 4 t1.period 4181
|
||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t3 index period period 4 NULL 41810
|
||||
t1 ref period period 4 t3.period 4181
|
||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 index period period 4 NULL 41810
|
||||
t3 ref period period 4 t1.period 4181
|
||||
select period from t1;
|
||||
period
|
||||
9410
|
||||
|
@ -16,7 +16,7 @@ table type possible_keys key key_len ref rows Extra
|
||||
t1 const UNIQ UNIQ 8 const 1
|
||||
drop table t1;
|
||||
select x'hello';
|
||||
You have an error in your SQL syntax near 'x'hello'' at line 1
|
||||
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 'x'hello'' at line 1
|
||||
select 0xfg;
|
||||
Unknown column '0xfg' in 'field list'
|
||||
create table t1 select 1 as x, 2 as xx;
|
||||
|
@ -1,8 +1,7 @@
|
||||
#
|
||||
# Test of problem when shutting down mysqld at once after ALTER TABLE
|
||||
#
|
||||
-- source include/have_bdb.inc
|
||||
|
||||
#
|
||||
# Small basic test for ALTER TABLE bug ..
|
||||
#
|
||||
drop table if exists t1;
|
||||
create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
|
||||
insert into t1 values(1, 't1',4,9);
|
||||
@ -10,3 +9,5 @@ insert into t1 values(2, 'metatable',1,9);
|
||||
insert into t1 values(3, 'metaindex',1,9 );
|
||||
select * from t1;
|
||||
alter table t1 drop column test;
|
||||
|
||||
# Now we do a reboot and continue with the next test
|
||||
|
2
mysql-test/t/bdb-alter-table-2-master.opt
Normal file
2
mysql-test/t/bdb-alter-table-2-master.opt
Normal file
@ -0,0 +1,2 @@
|
||||
--skip-external-locking
|
||||
|
@ -1,3 +1,8 @@
|
||||
#
|
||||
# Note that this test uses tables from the previous test
|
||||
# This is to test that the table t1 survives a reboot of MySQL
|
||||
# The options in the -master.opt file are just there to force the reboot
|
||||
#
|
||||
-- source include/have_bdb.inc
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
drop table t1;
|
||||
|
@ -1405,9 +1405,9 @@ drop table tmp;
|
||||
|
||||
# big table done
|
||||
|
||||
SET OPTION SQL_BIG_TABLES=1;
|
||||
SET SQL_BIG_TABLES=1;
|
||||
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
|
||||
SET OPTION SQL_BIG_TABLES=0;
|
||||
SET SQL_BIG_TABLES=0;
|
||||
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
|
||||
select distinct fld5 from t2 limit 10;
|
||||
|
||||
@ -1416,9 +1416,9 @@ select distinct fld5 from t2 limit 10;
|
||||
#
|
||||
|
||||
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
|
||||
SET OPTION SQL_BIG_TABLES=1; # Force use of MyISAM
|
||||
SET SQL_BIG_TABLES=1; # Force use of MyISAM
|
||||
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
|
||||
SET OPTION SQL_BIG_TABLES=0;
|
||||
SET SQL_BIG_TABLES=0;
|
||||
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
|
||||
|
||||
#
|
||||
@ -1439,6 +1439,14 @@ select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr orde
|
||||
|
||||
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
|
||||
|
||||
#
|
||||
# Some test with ORDER BY and limit
|
||||
#
|
||||
|
||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
|
||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
|
||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
|
||||
|
||||
#
|
||||
# Search with a constant table.
|
||||
#
|
||||
|
Reference in New Issue
Block a user