Benchmark Test for Mysql Performance using Php

Benchmark test for Mysql Performance

We can benchmark test the MySql Performance in the database by placing the following code in the server and running it

Make a php file using the code given below, Use a test database in the server, This code creates 32000 fields in the DB and returns the count and time to the browser

$con = mysqli_connect("localhost","root","Bukoku2012","test");
if (mysqli_connect_errno())
echo "Failed to connect to MySQL: " . mysqli_connect_error();
$start = microtime(true);
for ($i=1; $i < 32000; $i++) {
mysqli_query($con,"INSERT INTO name (t,l) VALUES ('Quagmire-$i','33-$i')");
echo $i."<br>";
$time_elapsed_secs = microtime(true) - $start;
echo $time_elapsed_secs." seconds";