use strict; use DBI; my $connstr = 'dbi:mysql:port=9306;host=127.0.0.1'; my $user = 'root'; { my $dbh1 = DBI->connect($connstr, $user); $dbh1->do("CREATE DATABASE IF NOT EXISTS test"); $dbh1->do("USE test"); $dbh1->do("DROP TABLE IF EXISTS t1"); $dbh1->do("DROP TABLE IF EXISTS t2"); $dbh1->do("CREATE TABLE IF NOT EXISTS t1 (f1 integer not null auto_increment, primary key (f1)) ENGINE = Falcon;"); $dbh1->do("CREATE TABLE IF NOT EXISTS t2 (f2 integer not null auto_increment, primary key (f2)) ENGINE = Falcon;"); $dbh1->do("CREATE OR REPLACE ALGORITHM = Merge VIEW v12 (f1, f2) AS SELECT * FROM t1 LEFT JOIN t2 ON (f1 = f2) ORDER BY f2 DESC;"); $dbh1->do("CREATE OR REPLACE ALGORITHM = Merge VIEW v21 (f1, f2) AS SELECT * FROM t2 LEFT JOIN t1 ON (f2 = f1) ORDER BY f1 DESC;"); $dbh1->do("CREATE OR REPLACE ALGORITHM = Merge VIEW v1221 (f1, f2 ) AS SELECT v12.f1, v21.f2 FROM v12 LEFT JOIN v21 ON (v12.f1 = v21.f2);"); $dbh1->do("CREATE OR REPLACE ALGORITHM = Temptable VIEW v2112 (f2, f1) AS SELECT v21.f2, v12.f1 FROM v21, v12;"); $dbh1->disconnect(); } fork(); fork(); use strict; use DBI; my $dbh2 = DBI->connect($connstr, $user); foreach my $i (1..1000) { $dbh2->do("USE test"); $dbh2->do("INSERT IGNORE INTO t1 (f1) VALUES (1), (2), (3);"); $dbh2->do("INSERT IGNORE INTO t2 (f2) VALUES (1), (2), (3);"); $dbh2->do("UPDATE v1221 SET f2 = (SELECT MAX(f2) FROM v2112) + 20 ORDER BY f2 DESC LIMIT 1;"); $dbh2->do("UPDATE v21 AS a LEFT JOIN v12 AS b ON (a.f1 = b.f1) SET a.f1 = a.f1 + 20;"); }