mysql的速度测试

来源:互联网 发布:光大金阳光软件 编辑:程序博客网 时间:2024/05/16 18:44

小草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

- systemMAC osSoftware  OS X 10.9.4 (13E28)Processor  2.4 GHz Intel Core i5Memory  8 GB 1600 MHz DDR3250GB SSD- environmentxampp 1.8.3Apache/2.4.9PHP Version 5.5.11mysqlnd 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

100 Loop And 100 Fetch Test Insert

Second test result

100 Loop And 100 Fetch Test Insert

Third test result

100 Loop And 100 Fetch Test Insert

And then mysql is like this:

100 Loop And 100 Fetch Test Insert




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:

100 Loop And 100 Fetch Test Select




0x04.Select a data exist in 30000 pieces data

Test result is here:

100 Loop And 100 Fetch Test Select




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:

100 Loop And 100 Fetch Test Select

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:

100 Loop And 100 Fetch Test Update




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


-By xiaocao

2014-09-19 19:16:45

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 儿童在学校打人怎么办 两岁儿童打人怎么办 孩子哭闹要东西怎么办 高中孩子爱打架怎么办 宝宝性格太弱怎么办 宝宝太老实了怎么办 一岁多宝宝爱打人怎么办 一岁半宝宝爱打人怎么办 两岁半宝宝喜欢打人怎么办 孩子总是挨欺负怎么办 一年级孩子爱打架怎么办 孩子没规矩家长怎么办 小朋友在幼儿园打人怎么办 幼儿园小朋友喜欢打人怎么办 三周岁宝宝爱哭怎么办 2周岁宝宝爱哭怎么办 一个月宝宝爱哭怎么办 2岁宝宝爱哭怎么办 三岁小朋友打人怎么办 一岁半小朋友喜欢打人怎么办 爷爷偏心我该怎么办 冲动型学生老师怎么办 两个宝宝争东西怎么办 2周岁宝宝打人怎么办 小孩幼儿园被打怎么办 小孩喝了润滑油怎么办 孩子被打了怎么办 宝宝吃了指甲油怎么办 孩子掉了深海怎么办 小孩打了别人怎么办 两岁宝宝爱咬人怎么办 孩子上学老打人怎么办 孩子上学爱说话怎么办 孩子抢玩具打人怎么办 生气就像打人怎么办 小孩总喜欢打人怎么办 小孩性格好翘怎么办 一岁小宝宝打人怎么办 小孩子老喜欢打人怎么办 孩子被大人欺负怎么办 小孩识字量少怎么办