Bug #56225 Implement MERGE algorithm for views which use UNION ALL
Description:
Currently merge algorithm can not be used for views which contain UNION ALL, although creating temporary table not always needed when using such views.
See http://forums.mysql.com/read.php?100,56681,56681 for detailed discussion about the problem.
How to repeat:
create table one (
id int(11) default null,
descr varchar(255)
) Engine = MyISAM;
create table two (
id int(11) default null,
descr varchar(255)
) Engine = MyISAM;
create algorithm=merge view v as
select * from one
union all
select * from two ;
insert into one values(1, 'fdsd');
insert into two values(1, 'fdsd');
flush status;
show status like '%tmp%';
select descr from v where id > 1000 ;
show status like '%tmp%';
Result:
create table one (
id int(11) default null,
descr varchar(255)
) Engine = MyISAM;
create table two (
id int(11) default null,
descr varchar(255)
) Engine = MyISAM;
create algorithm=merge view v as
select * from one
union all
select * from two ;
Warnings:
Warning 1354 View merge algorithm can't be used here for now (assumed undefined algorithm)
insert into one values(1, 'fdsd');
insert into two values(1, 'fdsd');
flush status;
show status like '%tmp%';
Variable_name Value
Created_tmp_disk_tables 0
Created_tmp_files 0
Created_tmp_tables 0
select descr from v where id > 1000 ;
descr
show status like '%tmp%';
Variable_name Value
Created_tmp_disk_tables 0
Created_tmp_files 0
Created_tmp_tables 2
Suggested fix:
Implement MERGE algorithm for such views.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.