星空网 > 软件开发 > 数据库

mysql插入多条数据时间复杂度比较

select * from users;

  • 方式一:

insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");
insert into users(name, age, course_id) VALUES("test",1, "0");

  • 方式二:

insert into users(name, age, course_id) VALUES("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0"),

("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0"),
("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0"),
("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0"),
("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0"),
("test",1, "0"),("test",1, "0"),("test",1, "0"),("test",1, "0")


  • 时间损耗

在插入上面24条数据的时候发现两者的执行效率相差比较大(近10倍的)

  方式一:

mysql插入多条数据时间复杂度比较

  方式二:

mysql插入多条数据时间复杂度比较


 

  •  扩展:

那么jdbc中的批处理的内部实现是不是采用方式二的形式来实现呢?感兴趣的朋友可以查看下该部分的源码...

  




原标题:mysql插入多条数据时间复杂度比较

关键词:MYSQL

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

2022出海中东:沙特阿拉伯电商市场现状及发展前景:https://www.ikjzd.com/articles/1582658858983845890
跨境卖家怎么进行美国税务申报?如何保证美国税务合规?:https://www.ikjzd.com/articles/1582662025972817922
最低3.6美元,eBay卖家运费大降:https://www.ikjzd.com/articles/1582665643983642625
新手做虾皮必看攻略!五步让你成为shopee虾皮热销卖家:https://www.ikjzd.com/articles/1582685675899854849
为什么你的shopee虾皮店铺越做越垮?极有可能是这三点没做好?:https://www.ikjzd.com/articles/1582687139829391362
紧急通知:亚马逊要赔钱,制造商条形码不能用了!:https://www.ikjzd.com/articles/15828
夹江千佛岩景区门票(夹江千佛岩景区门票价格):https://www.vstour.cn/a/411232.html
武陵山大裂谷周围景点 武陵山大裂谷周围景点图片:https://www.vstour.cn/a/411233.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流