MySQL Performance test PHP version

Source: Internet
Author: User

All database structures are as follows, some IDs are int, see comments

100W Data:

ID is an indexed field, 4 bytes of int, and the database engine is MyISAM

Echo"<br>". Xdebug_time_index (). " <br> "; 0.011001110076904 for($i= 0;$i< 10000;$i++) {     $random=Mt_rand(1,999999); $id=$random; $sql= "SELECT * from test100m where id=".$id.""; $result=mysql_query($sql,$con);}Echo"<br>". Xdebug_time_index (). "  <br> "; 1.0551059246063

10,000 queries, 1s or so, each select 0.1ms

100W Data:

ID is an indexed field, 4 bytes of int, and the database engine is InnoDB

Echo"<br>". Xdebug_time_index (). " <br> "; 0.011001110076904 for($i= 0;$i< 10000;$i++) {     $random=Mt_rand(1,999999); $id=$random; $sql= "SELECT * from Test100m_innodb where id=".$id.""; $result=mysql_query($sql,$con);}Echo"<br>". Xdebug_time_index (). "  <br> "; 1.1981191635132

10,000 queries, 1s or so, each select 0.1ms

200W Data:

ID is an indexed field, 4 bytes of int, and the database engine is InnoDB

Echo"<br>". Xdebug_time_index (). " <br> "; 0.00099992752075195 for($i= 0;$i< 1000;$i++) {     $random=Mt_rand(1,1999999); $id=$random; $sql= "SELECT * from test200m where id=".$id.""; $result=mysql_query($sql,$con); }Echo"<br>". Xdebug_time_index (). "  <br> "; 4.5234520435333

1000 queries, 4.5s or so, each select 4.5ms

500W Data:

ID is an indexed field, 4 bytes of int, and the database engine is InnoDB

Echo"<br>". Xdebug_time_index (). " <br> "; 0.0010001659393311 for($i= 0;$i< 1000;$i++) {     $random=Mt_rand(1,4999999); $id=$random; $sql= "SELECT * from test500m where id=".$id.""; $result=mysql_query($sql,$con); }Echo"<br>". Xdebug_time_index (). "  <br> "; 5.0744871616364

1000 queries, 5s or so, each select 5ms

1000W Data:

ID is an indexed field, 4 bytes of int, and the database engine is MyISAM

Echo"<br>". Xdebug_time_index (). " <br> "; 0.0010008811950684 for($i= 0;$i< 100;$i++) {     $random=Mt_rand(1,9999999); $id=$random; $sql= "SELECT * from test1000m where id=".$id.""; $result=mysql_query($sql,$con); }Echo"<br>". Xdebug_time_index (). "  <br> "; 1.5391540527344

100 queries, 1.5s or so, each select 15ms

1000W Data:

ID is an indexed field, 8 bytes of bigint, and the database engine is MyISAM

Echo"<br>". Xdebug_time_index (). " <br> "; 0.00099992752075195 for($i= 0;$i< 100;$i++) {     $random=Mt_rand(1,9999999); $id=$random.‘ 0 '.$random.‘ 0 '; $sql= "SELECT * from Test1000m_bigint where id=".$id.""; $result=mysql_query($sql,$con);}Echo"<br>". Xdebug_time_index (). "  <br> "; 1.2141208648682

100 times, 1.2s, average per select 12ms

1000W Data:

ID is an indexed field, 8 bytes of bigint, and the database engine is MyISAM

Code as above

100 times, 1.2s, average per select 12ms

Conclusion:

Data volume engine average Time index field

100W MyISAM 0.1ms

100W InnoDB 0.1ms

200W InnoDB 4.5ms

500W InnoDB 5ms

1000W MyISAM 15ms (paralysis is incredibly slower than bigint)

1000W InnoDB 12ms (bigint)

1000W MyISAM 12ms (bigint)

MySQL Performance test PHP version

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.