资讯专栏INFORMATION COLUMN

mysql的速度测试

HitenDev / 1008人阅读

摘要:小草

  

小草blog : http://homeway.me/

The artile is about a php module for mysql
It likes codeigniter,but has some other feature.
And then, I test It`s speed.
Fork me here: https://github.com/grasses/JueQuery



0x01.System Environment
- system
MAC os
Software  OS X 10.9.4 (13E28)
Processor  2.4 GHz Intel Core i5
Memory  8 GB 1600 MHz DDR3
250GB SSD

- environment
xampp 1.8.3
Apache/2.4.9
PHP Version 5.5.11
mysqlnd 5.0.11-dev - 20120503 - (mysql is empty)
0x02.Test Insert Code is here
$jue = new JueQuery();

for($i=0; $i<100; $i++){

    $insert_data = array(
        "email"=>"xiaocao.grasses@gmail.com", 
        "username"=>"http://homeway.me/", 
        "password"=>md5( rand().time() ),
    );

    $insert_test = $jue->insert_where("user", $insert_data );
}
First test result

Second test result

Third test result

And then mysql is like this:




0x03.Select a data does not exist in 30000 pieces data Code is here
for($i=0; $i<100; $i++){
    $single = true;
    $where = array(
        "username"=>"http://homeway.me/", 
        "password"=>"6f27e19bbdd4f290038149344fcc5ffd",
    );
    $select_test = $jue->select("id|username|email")->order_by("id", "ASC")->get_where("user", $where,$single);
    $jue->debug("Select Test", $select_test);
}
Test result is here:




0x04.Select a data exist in 30000 pieces data Test result is here:




Ox05.Select a data exist in 30000 pieces data using normal function without class Code is here
for ($i=1; $i < 100 ; $i++) { 
    $select = "SELECT * FROM `user` WHERE `password` = "d29a75d265e91f0de0342443eb2731b5"";
    $select_result = mysql_query($select);
}
Test result is here:

From result we know that, run class and function, only using 10 seconds in 10000 fetch, so class is efficiention




0x06.Update 30000 in 30000 pieces of data Code is here:
for($i=0; $i<100; $i++){
    $where = array(
        "id"=>$i,
    );

    $set = array(
        "username"=>"http://homeway.me/",
        "email"=>"xiaocao.grasses@gmail.com",
    );
    $update_test = $jue->update_where("user", $where, $set);
}
Test result is here:




Please indicate the source:http://homeway.me/2014/09/19/PHP-Module-Mysql/


-By xiaocao

2014-09-19 19:16:45

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/20843.html

相关文章

  • Mongodb 与 MySQL对比

    摘要:通过计算机特征值时间进程与随机数来确保生成的是唯一的。整体上来看,的速率波动比的严重,方差变化较大。的缺陷事务关系支持薄弱。一方面在方便开发者的同时,另一方面对运维人员却提出了相当多的要求。 在数据库存放的数据中,有一种特殊的键值叫做主键,它用于惟一地标识表中的某一条记录。也就是说,一个表不能有多个主键,并且主键不能为空值。无论是MongoDB还是MySQL,都存在着主键的定义。对于M...

    PingCAP 评论0 收藏0
  • 一文教您如何通过 Docker 快速搭建各种测试环境(Mysql, Redis, Elasticse

    摘要:本文主要说说如何配置阿里云的镜像加速器。通过修改配置文件来使用加速器执行下面命令验证一下速度以下载为例,看下速度下载配置了加速器过后,速度终于飚起来了。二快速安装搭建环境本节中,我们将学习如何通过快速安装与搭建环境。 欢迎关注个人微信公众号: 小哈学Java, 优质文章第一时间推送哟!! 个人网站: www.exception.site 小哈今天给大家分享的主题是,如何通过 Docker ...

    FleyX 评论0 收藏0

发表评论

0条评论

HitenDev

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<