use DBI; if(fork()){ my $dbh = DBI->connect("dbi:mysql:hostname=127.0.0.1;database=test;port=5157", "msandbox", "msandbox"); for my $i (1..3){ $dbh->do("insert into t (a) values ($i)"); select(undef, undef, undef, 0.01); } } else { my $dbh = DBI->connect("dbi:mysql:hostname=127.0.0.1;database=test;port=5157", "msandbox", "msandbox"); $dbh->do("insert into t (a) values (" . join("),(", 10000 .. 20000) . ")"); }