I ran into a problem, I'm using MyIsam tables in mysql database, using PDO to connect.In all my tests (calling for 1 user everything works fine), now having around 300 users connected at the same time all day making requests is really really slowing down mySQL. Ive got my.cnf with (key_buffer=512M and max_connections=200) my server is VPS with 2GB RAM and 3 cores. And each table has around 40K recordsAll queries/updates/inserts are super slow, but I've discovered that this PHP file is the root of the problem, it's requested every 10 seconds for every user (not at the same time, and if the call fails it's delayed another 10 seconds): //User Info -----------------------     $sqlcommand = SELECT * FROM tbl_User WHERE FB_ID='. $FB_ID . ';    $statement = $pdo->query($sqlcommand);    $row = $statement->fetch(PDO::FETCH_ASSOC);     if($row) {       //Do its thing    }//How Many Gifts are there-----------------     $sqlcommand = SELECT * FROM tbl_Gifts_Sent WHERE FB_ID='. $FB_ID . ';    $statement = $pdo->query($sqlcommand);    $row = $statement->fetchAll();    if (!$row) {        $amountOfGifts=0;    } else {        foreach ($pdo->query($sqlcommand) as $row){                $amountOfGifts=$amountOfGifts+1;        }    }//Daily Leaderboard King---------------     $sqlcommand = SELECT * FROM tbl_Leaderboard_DAY WHERE Today =  . $midnight .  ORDER BY XP_Gain DESC;    $statement = $pdo->query($sqlcommand);    $row = $statement->fetch(PDO::FETCH_ASSOC);     if ($row) {        //Do its thing    } //-------- THE STATE ON ALL Themes WITH GIFTS AND ALL        $sqlcommand = SELECT * FROM tbl_User_Reel WHERE FB_ID='. $FB_ID . ';    foreach ($pdo->query($sqlcommand) as $db_gmInfo){           //DO its thing    }this 4 queries are on the same php file.Im a newbie in this and this is my first php mysql project, so I'm thinking there's gotta be a better way to do this, :S any recommendations, help or pointers on how to make it work super fast are greatly appreciated! thank you
PHP PDO mysql multiple queries mak
php;mysql;pdo