Commit f813131c authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 5.5 into 10.1

parents f9639c2d 24cb76b8
...@@ -1685,6 +1685,58 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1685,6 +1685,58 @@ id select_type table type possible_keys key key_len ref rows Extra
DROP TABLE t1; DROP TABLE t1;
set optimizer_switch= @optimizer_switch_save; set optimizer_switch= @optimizer_switch_save;
# #
# MDEV-21932: ROR union with index_merge_sort_union=off
#
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
insert into t0 select a+10 from t0;
insert into t0 select a+20 from t0;
insert into t0 select a+40 from t0;
insert into t0 select a+80 from t0;
insert into t0 select a+160 from t0;
delete from t0 where a > 300;
create table t1 (
f1 int, f2 int, f3 int, f4 int,
primary key (f1), key (f3), key(f4)
) engine=myisam;
insert into t1 select a+100, a+100, a+100, a+100 from t0;
insert into t1 VALUES (9,0,2,6), (9930,0,0,NULL);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
set optimizer_switch='index_merge_sort_union=off';
set optimizer_switch='index_merge_union=on';
explain select * from t1
where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where
select * from t1
where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
f1 f2 f3 f4
9 0 2 6
insert into t1 values (52,0,1,0),(53,0,1,0);
insert into t1 values (50,0,1,0),(51,0,1,0);
insert into t1 values (48,0,1,0),(49,0,1,0);
insert into t1 values (46,0,1,0),(47,0,1,0);
insert into t1 values (44,0,1,0),(45,0,1,0);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
explain select * from t1
where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 13 Using union(f3,PRIMARY,f3); Using where
select * from t1
where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
f1 f2 f3 f4
9 0 2 6
drop table t0,t1;
set optimizer_switch= @optimizer_switch_save;
#
# MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union # MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union
# #
create table t0 create table t0
...@@ -1719,3 +1771,4 @@ key1 key2 key3 key8 ...@@ -1719,3 +1771,4 @@ key1 key2 key3 key8
3 3 3 1021 3 3 3 1021
set @@optimizer_switch= @optimizer_switch_save; set @@optimizer_switch= @optimizer_switch_save;
drop table t0; drop table t0;
# End of 10.1 tests
...@@ -37,6 +37,33 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -37,6 +37,33 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 1 SIMPLE t0 ALL NULL NULL NULL NULL 10
1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join)
drop table t0,t1,t2; drop table t0,t1,t2;
#
# MDEV-10466: constructing an invalid SEL_ARG
#
create table t1 (
pk int, a int, b int,
primary key (pk), index idx1(b), index idx2(b)
) engine=innodb;
Warnings:
Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release.
insert into t1 values (1,6,0),(2,1,0),(3,5,2),(4,8,0);
create table t2 (c int) engine=innodb;
insert into t2 values (1),(2);
create table t3 (d int) engine=innodb;
insert into t3 values (3),(-1),(4);
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
explain
select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using join buffer (flat, BNL join)
1 SIMPLE t1 ALL PRIMARY,idx1,idx2 NULL NULL NULL 4 Using where; Using join buffer (incremental, BNL join)
select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0';
pk a b
1 6 0
set optimizer_switch=@save_optimizer_switch;
drop table t1,t2,t3;
CREATE TABLE t1 ( CREATE TABLE t1 (
pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1), pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
KEY(f1), KEY(f2) KEY(f1), KEY(f2)
...@@ -79,3 +106,4 @@ ERROR HY000: Table definition has changed, please retry transaction ...@@ -79,3 +106,4 @@ ERROR HY000: Table definition has changed, please retry transaction
DROP TABLE t0,t1; DROP TABLE t0,t1;
set @@global.debug_dbug="-d"; set @@global.debug_dbug="-d";
set @@optimizer_switch= @optimizer_switch_save; set @@optimizer_switch= @optimizer_switch_save;
# End of 10.1 tests
...@@ -1659,7 +1659,7 @@ SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) ...@@ -1659,7 +1659,7 @@ SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 ); OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY,f3,f4 NULL NULL NULL 2 Using where 1 SIMPLE t1 index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 Using union(f3,PRIMARY,f3); Using where
SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4) SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10 WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 ); OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
......
...@@ -243,6 +243,55 @@ DROP TABLE t1; ...@@ -243,6 +243,55 @@ DROP TABLE t1;
set optimizer_switch= @optimizer_switch_save; set optimizer_switch= @optimizer_switch_save;
--echo #
--echo # MDEV-21932: ROR union with index_merge_sort_union=off
--echo #
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
insert into t0 select a+10 from t0;
insert into t0 select a+20 from t0;
insert into t0 select a+40 from t0;
insert into t0 select a+80 from t0;
insert into t0 select a+160 from t0;
delete from t0 where a > 300;
create table t1 (
f1 int, f2 int, f3 int, f4 int,
primary key (f1), key (f3), key(f4)
) engine=myisam;
insert into t1 select a+100, a+100, a+100, a+100 from t0;
insert into t1 VALUES (9,0,2,6), (9930,0,0,NULL);
analyze table t1;
set optimizer_switch='index_merge_sort_union=off';
set optimizer_switch='index_merge_union=on';
let $q1=
select * from t1
where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
eval explain $q1;
eval $q1;
insert into t1 values (52,0,1,0),(53,0,1,0);
insert into t1 values (50,0,1,0),(51,0,1,0);
insert into t1 values (48,0,1,0),(49,0,1,0);
insert into t1 values (46,0,1,0),(47,0,1,0);
insert into t1 values (44,0,1,0),(45,0,1,0);
analyze table t1;
let $q2=
select * from t1
where (( f3 = 1 or f1 = 7 ) and f1 < 10) or
(f3 between 2 and 2 and ( f3 = 1 or f4 < 7 ));
eval explain $q2;
eval $q2;
drop table t0,t1;
set optimizer_switch= @optimizer_switch_save;
--echo # --echo #
--echo # MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union --echo # MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union
--echo # --echo #
...@@ -270,3 +319,5 @@ explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z. ...@@ -270,3 +319,5 @@ explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.
select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5;
set @@optimizer_switch= @optimizer_switch_save; set @@optimizer_switch= @optimizer_switch_save;
drop table t0; drop table t0;
--echo # End of 10.1 tests
...@@ -46,6 +46,32 @@ explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250; ...@@ -46,6 +46,32 @@ explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
drop table t0,t1,t2; drop table t0,t1,t2;
--echo #
--echo # MDEV-10466: constructing an invalid SEL_ARG
--echo #
create table t1 (
pk int, a int, b int,
primary key (pk), index idx1(b), index idx2(b)
) engine=innodb;
insert into t1 values (1,6,0),(2,1,0),(3,5,2),(4,8,0);
create table t2 (c int) engine=innodb;
insert into t2 values (1),(2);
create table t3 (d int) engine=innodb;
insert into t3 values (3),(-1),(4);
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
explain
select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0';
select pk, a, b from t1,t2,t3 where b >= d and pk < c and b = '0';
set optimizer_switch=@save_optimizer_switch;
drop table t1,t2,t3;
CREATE TABLE t1 ( CREATE TABLE t1 (
pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1), pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1),
KEY(f1), KEY(f2) KEY(f1), KEY(f2)
...@@ -87,3 +113,5 @@ select * from t1 where a=10 and b=10; ...@@ -87,3 +113,5 @@ select * from t1 where a=10 and b=10;
DROP TABLE t0,t1; DROP TABLE t0,t1;
set @@global.debug_dbug="-d"; set @@global.debug_dbug="-d";
set @@optimizer_switch= @optimizer_switch_save; set @@optimizer_switch= @optimizer_switch_save;
--echo # End of 10.1 tests
...@@ -6827,6 +6827,13 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, ...@@ -6827,6 +6827,13 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
update_tbl_stats, &mrr_flags, update_tbl_stats, &mrr_flags,
&buf_size, &cost); &buf_size, &cost);
if (!param->is_ror_scan &&
!optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION))
{
/* The scan is not a ROR-scan, just skip it */
continue;
}
if (found_records != HA_POS_ERROR && tree->index_scans && if (found_records != HA_POS_ERROR && tree->index_scans &&
(index_scan= (INDEX_SCAN_INFO *)alloc_root(param->mem_root, (index_scan= (INDEX_SCAN_INFO *)alloc_root(param->mem_root,
sizeof(INDEX_SCAN_INFO)))) sizeof(INDEX_SCAN_INFO))))
...@@ -8865,7 +8872,7 @@ key_and(RANGE_OPT_PARAM *param, SEL_ARG *key1, SEL_ARG *key2, uint clone_flag) ...@@ -8865,7 +8872,7 @@ key_and(RANGE_OPT_PARAM *param, SEL_ARG *key1, SEL_ARG *key2, uint clone_flag)
if (key2->next_key_part) if (key2->next_key_part)
{ {
key1->use_count--; // Incremented in and_all_keys key1->use_count--; // Incremented in and_all_keys
return and_all_keys(param, key1, key2, clone_flag); return and_all_keys(param, key1, key2->next_key_part, clone_flag);
} }
key2->use_count--; // Key2 doesn't have a tree key2->use_count--; // Key2 doesn't have a tree
} }
......
SET(HEIDISQL_BASE_NAME "HeidiSQL_10.2_32_Portable") SET(HEIDISQL_BASE_NAME "HeidiSQL_11.0_32_Portable")
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip") SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}") SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME}) SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
......
...@@ -33,20 +33,25 @@ ...@@ -33,20 +33,25 @@
<RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts.heidisql" Value="1" Type="string" KeyPath="yes" /> <RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts.heidisql" Value="1" Type="string" KeyPath="yes" />
<Shortcut Id="startmenuHeidiSQL" Directory="ShortcutFolder" Name="HeidiSQL" Target="[D.HeidiSQL]\heidisql.exe"/> <Shortcut Id="startmenuHeidiSQL" Directory="ShortcutFolder" Name="HeidiSQL" Target="[D.HeidiSQL]\heidisql.exe"/>
</Component> </Component>
<Component Id="component.HeidiSQL_libmysql.dll" Guid="*" Win64="no"> <Component Id="component.HeidiSQL_libmysql.dll" Guid="*" Win64="no">
<File Id="heidisql.libmysql.dll" Name="libmysql.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql.dll" /> <File Id="heidisql.libmysql.dll" Name="libmysql.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql.dll" />
</Component> </Component>
<Component Id="component.HeidiSQL_libmysql_6.1.dll" Guid="*" Win64="no">
<File Id="heidisql.libmysql_6.1.dll" Name="libmysql-6.1.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql-6.1.dll" />
</Component>
<Component Id="component.HeidiSQL_libmariadb.dll" Guid="*" Win64="no"> <Component Id="component.HeidiSQL_libmariadb.dll" Guid="*" Win64="no">
<File Id="heidisql.libmariadb.dll" Name="libmariadb.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmariadb.dll" /> <File Id="heidisql.libmariadb.dll" Name="libmariadb.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmariadb.dll" />
</Component> </Component>
<Component Id="component.HeidiSQL_libeay32.dll" Guid="*" Win64="no"> <Component Id="component.HeidiSQL_libssl_1_1.dll" Guid="*" Win64="no">
<File Id="heidisql.libeay32.dll" Name="libeay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libeay32.dll" /> <File Id="heidisql.libssl_1_1.dll" Name="libssl-1_1.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libssl-1_1.dll" />
</Component> </Component>
<Component Id="component.HeidiSQL_libpq.dll" Guid="*" Win64="no"> <Component Id="component.HeidiSQL_libpq_10.dll" Guid="*" Win64="no">
<File Id="heidisql.libpq.dll" Name="libpq.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libpq.dll" /> <File Id="heidisql.libpq_10.dll" Name="libpq-10.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libpq-10.dll" />
</Component> </Component>
<Component Id="component.HeidiSQL_ssleay32.dll" Guid="*" Win64="no"> <Component Id="component.HeidiSQL_libcrypto_1_1.dll" Guid="*" Win64="no">
<File Id="heidisql.ssleay32.dll" Name="ssleay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\ssleay32.dll" /> <File Id="heidisql.libcrypto_1_1.dll" Name="libcrypto-1_1.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libcrypto-1_1.dll" />
</Component> </Component>
<Component Id="component.HeidiSQL_libintl_8.dll" Guid="*" Win64="no"> <Component Id="component.HeidiSQL_libintl_8.dll" Guid="*" Win64="no">
<File Id="heidisql.libintl_8.dll" Name="libintl-8.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libintl-8.dll" /> <File Id="heidisql.libintl_8.dll" Name="libintl-8.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libintl-8.dll" />
...@@ -54,6 +59,9 @@ ...@@ -54,6 +59,9 @@
<Component Id="component.HeidiSQL_libiconv_2.dll" Guid="*" Win64="no"> <Component Id="component.HeidiSQL_libiconv_2.dll" Guid="*" Win64="no">
<File Id="heidisql.libiconv_2.dll" Name="libiconv-2.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libiconv-2.dll" /> <File Id="heidisql.libiconv_2.dll" Name="libiconv-2.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libiconv-2.dll" />
</Component> </Component>
<Component Id="component.HeidiSQL_sqlite3.dll" Guid="*" Win64="no">
<File Id="heidisql.sqlite3.dll" Name="sqlite3.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\sqlite3.dll" />
</Component>
<Directory Id="D.HeidiSQL.plugins" Name="plugins"> <Directory Id="D.HeidiSQL.plugins" Name="plugins">
<?foreach dll in $(var.pluginlist) ?> <?foreach dll in $(var.pluginlist) ?>
...@@ -76,11 +84,13 @@ ...@@ -76,11 +84,13 @@
<ComponentRef Id="component.HeidiSQL_MenuShortcut"/> <ComponentRef Id="component.HeidiSQL_MenuShortcut"/>
<ComponentRef Id="component.HeidiSQL_libmysql.dll"/> <ComponentRef Id="component.HeidiSQL_libmysql.dll"/>
<ComponentRef Id="component.HeidiSQL_libmariadb.dll"/> <ComponentRef Id="component.HeidiSQL_libmariadb.dll"/>
<ComponentRef Id="component.HeidiSQL_libeay32.dll" /> <ComponentRef Id="component.HeidiSQL_libssl_1_1.dll" />
<ComponentRef Id="component.HeidiSQL_libpq.dll" /> <ComponentRef Id="component.HeidiSQL_libpq_10.dll" />
<ComponentRef Id="component.HeidiSQL_ssleay32.dll" /> <ComponentRef Id="component.HeidiSQL_libcrypto_1_1.dll" />
<ComponentRef Id="component.HeidiSQL_libintl_8.dll" /> <ComponentRef Id="component.HeidiSQL_libintl_8.dll" />
<ComponentRef Id="component.HeidiSQL_libiconv_2.dll" /> <ComponentRef Id="component.HeidiSQL_libiconv_2.dll" />
<ComponentRef Id="component.HeidiSQL_sqlite3.dll" />
<ComponentRef Id="component.HeidiSQL_libmysql_6.1.dll" />
<?foreach dll in $(var.pluginlist)?> <?foreach dll in $(var.pluginlist)?>
<ComponentRef Id="component.HeidiSQL_$(var.dll)" /> <ComponentRef Id="component.HeidiSQL_$(var.dll)" />
<?endforeach?> <?endforeach?>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment