Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $startTime = microtime(true);
- $dbh = new PDO('mysql:dbname=php_mysqltest;host=localhost', 'php', 'php');
- for($i = 0; $i < 90000; $i++) {
- $st = $dbh->prepare('INSERT INTO test (`test_int`, `test_float`, `test_string`) VALUES (:int, :float, :string)');
- $st->bindValue(':int', mt_rand(), PDO::PARAM_INT);
- $st->bindValue(':float', mt_rand()/mt_rand()*10);
- $st->bindValue(':string', sha1(mt_rand()));
- $st->execute();
- unset($st);
- }
- $endTime = microtime(true);
- echo 'Inserting ', $i, ' rows took ', $endTime - $startTime, ' seconds';
Add Comment
Please, Sign In to add comment