I use MySQL Workbench to run queries. It takes literally no time at all to run them. However, when I connect to the database via PDO, it takes over one second to connect! Why?
<?php
$host = "localhost";
$db = "localhost";
$user = "root";
$pass = "";
$mtime = explode(" ",microtime());
$starttime = $mtime[1] + $mtime[0];
$conn = new PDO("mysql:host=$host;dbname=$db",$user,$pass);
$mtime = explode(" ",microtime());
$totaltime = (($mtime[1] + $mtime[0]) - $starttime);
echo $totaltime * 1000;
This outputs:
1008.975982666