MySQL Forums
Forum List  »  Performance

mysql inserting performance is slow
Posted by: jief llefe
Date: May 03, 2017 09:08PM

sudo /usr/bin/mysqladmin -u -p extended-status -r -i1|grep -i Com_insert
| Com_insert | 1022904 |
| Com_insert_select | 0 |
| Com_insert | 2318 |
| Com_insert_select | 0 |
| Com_insert | 4003 |
| Com_insert_select | 0 |
| Com_insert | 2572 |
| Com_insert_select | 0 |
| Com_insert | 2050 |
| Com_insert_select | 0 |
| Com_insert | 3956 |
| Com_insert_select | 0 |
| Com_insert | 1902 |
| Com_insert_select | 0 |
| Com_insert | 4556 |
| Com_insert_select | 0 |
| Com_insert | 4584 |
| Com_insert_select | 0 |


sudo /usr/bin/mysqladmin -u -p extended-status -r -i1|grep -i Com_insert
| Com_insert | 29941 |
| Com_insert_select | 0 |
| Com_insert | 2566 |
| Com_insert_select | 0 |
| Com_insert | 3013 |
| Com_insert_select | 0 |
| Com_insert | 2829 |
| Com_insert_select | 0 |
| Com_insert | 2083 |
| Com_insert_select | 0 |
| Com_insert | 1537 |
| Com_insert_select | 0 |
| Com_insert | 2555 |
| Com_insert_select | 0 |

| Com_insert_select | 0 |
| Com_insert | 951 |
| Com_insert_select | 0 |
| Com_insert | 263 |
| Com_insert_select | 0 |
| Com_insert | 506 |
| Com_insert_select | 0 |
| Com_insert | 448 |
| Com_insert_select | 0 |
| Com_insert | 395 |
| Com_insert_select | 0 |
| Com_insert | 315 |
| Com_insert_select | 0 |
| Com_insert | 364 |
| Com_insert_select | 0 |

for i:=0;i<500;i++{
go insertUnis(db,"unis") //500个go程
}
common_package.WgDay.Wait()
//time.Sleep(2*time.Second)
return nil
}
func insert(db *sql.DB, name string){
sql := ""
user_name := string(Krand(64,0)) //生成64位的随机数
session_key:=string(Krand(56,0)) //生成56位的随机数
nat_ip := string(Krand(15,0)) //生成15位的随机数
Nas_IP := nat_ip //56
frame_ip := nat_ip //56
sql = "insert into unis values("+session_key+","+frame_ip+","+user_name+",'ee02:123::af01:9231:df18:8998','ee02:123::/64','0xBF019231DF188998','0xBF019231DF188999','a0:24:7e:68:0c:80','"+Nas_IP+"','40.2M','srunk 6/0/36:33.351 0/0/0/0/0/0',487204,587239,2458787490,'taefawega',2458787585,'20M','bj.com','21M','534111111111111111999253859','EE60-X10311900100000091463d000936','Aa:ef:dd','Eptv','Asfefji','Sefoij','"+nat_ip+"','70.11.69.45',1343,2454,2458787490);"
_, err := db.Exec(sql)
if err != nil {
Log(LL_ERROR, sql, ", err info:", err.Error(), ".")
}
}
func insertUnis(db *sql.DB, name string){
for i:=0;i<1000;i++{
insert(db,name);
}
common_package.WgDay.Done()
return
}

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql inserting performance is slow
1211
May 03, 2017 09:08PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.