use DBI; $dbh=DBI->connect('dbi:mysql:host=127.0.0.1;database=test','root'); $sth=$dbh->prepare('insert into t1 values (?,?)'); for($i = 0;$i<1000_000;$i++){ $sth->execute(1000000*rand(), 1000000*rand()); }