MySQL Space slow _php tutorial

Source: Internet
Author: User
MySQL space speed is slow
Answer


Ask everyone a question, I paid to rent a MySQL server virtual space, found that the speed is very slow. I use the simplest form query, every query will take more than 5 seconds, this normal?

In the database, there is only one table and two records,
Here is my test code:

$stime = Microtime (true); Gets the time that the program started executing

$db _ip = "61.152.93.83";

$db _user = ' blinnes ';

$db _pass = ' ji64edfw2 ';

$CN = mysql_connect ($db _ip, $db _user, $db _pass);

$db = mysql_select_db ("Blinn");

$sql = "SELECT * from ' Test '";

mysql_query ("Set names gb2312");

$rs = mysql_query ($sql);

while ($row = Mysql_fetch_array ($rs))

{

echo "mysql! - " . $row [' name ']. "|" . $row [' Quantity ']. "
";

}

Mysql_close ($CN);

$etime = Microtime (true); Gets the time that the program execution ended

$total = $etime-$stime; Calculate the difference value

echo "(MySQL version) This query execution time:". $total. "Seconds";

?>


Copy Code


Best answer [url=http://www.phpchina.com/bbs/space.php?username=fising] link tag Fising[/url]
[url=http://www.phpchina.com/bbs/space.php?uid=31544] link marker [img]http://www.phpchina.com/server/avatar.php?uid= 31544&size=small[/img][/url] Network connection overhead is too high. The database and the Web are best on a machine, not the best in a local area network can also.



Other Solutions
The network connection overhead is too high. The database and the Web are best on a machine, not the best in a local area network can also.

Other Solutions
Upstairs, it's very

Other Solutions
That is true. Many hosts do not even support remote connections.

Other Solutions
China Data Server Bar ~ This server has been broken, hehe

Server load is too high caused by

Other Solutions
Change the space and find a better one.

Other Solutions
Thank you all, problem solving. [Img]http://www.phpchina.com/bbs/images/smilies/default/victory.gif[/img]
It's really a server for Chinese data. [Img]http://www.phpchina.com/bbs/images/smilies/default/sleepy.gif[/img]
The estimate is that Fising said that the database and PHP is not a server reason, let them put the database space and PHP space on the same server, the speed is fast.

Other Solutions
[Img]http://www.phpchina.com/bbs/images/smilies/default/shocked.gif[/img]


http://www.bkjia.com/PHPjc/632378.html www.bkjia.com true http://www.bkjia.com/PHPjc/632378.html techarticle MySQL space slow answer ask everyone a question, I paid to rent a MySQL server virtual space, found that the speed is very slow. I use the simplest form of query, every query to use ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.