介绍MySQL数据库的预处理(prepared statement)性能测试


当前第2页 返回上一页

序号是否预处理语句是否远程数据库返回数据量每次实验语句执行总次数三次实验平均总耗时/单位毫秒
1select * from task where task.taskId in (?)1000100069822
2select * from task where task.taskId in (arr)1000100066778
3select * from task where task.taskId = ?110001260
4select * from task where task.taskId = id11000951
5select * from task a LEFT JOIN task_file b ON a.taskId = b.task_id where a.taskName like '%s%' and b.file_id > 100000 and b.file_id < 200000 and a.taskId = ?";210002130
6select * from task a LEFT JOIN task_file b ON a.taskId = b.task_id where a.taskName like '%s%' and b.file_id > 100000 and b.file_id < 200000 and a.taskId = 32327";210001480
7select * from task where task.taskId in (?)1000100057051
8select * from task where task.taskId in (arr)1000100056235
9select * from task where task.taskId = ?11000217
10select * from task where task.taskId = id11000204
11select * from task a LEFT JOIN task_file b ON a.taskId = b.task_id where a.taskName like '%s%' and b.file_id > 100000 and b.file_id < 200000 and a.taskId = ?";21000366
12select * from task a LEFT JOIN task_file b ON a.taskId = b.task_id where a.taskName like '%s%' and b.file_id > 100000 and b.file_id < 200000 and a.taskId = 32327";21000380

6、结论

实验的数据结果和我预期的相差有点儿大,但经过反复检查测试代码和测试过程,确认测试本身应该没有问题。尊重实验数据,我们得出以下结论:

1、通过实验5和实验6对比,实验11和实验12对比,可得猜想1是错误的。结论应该是:MySQL预处理和常规查询在简单语句和复杂语句下,都没有显著性的性能差别。

2、通过实验1和实验2对比,实验7和实验8对比,可得猜想2是错误的。结论应该是:MySQL预处理和常规查询的结果在数据传输上没有显著性的性能差距。

3、此外,对比远程数据库和本地数据库实验数据。可得结论:MySQL数据库在本地会给数据操作带来显著性的性能提高。

相关免费学习推荐:mysql数据库(视频)

以上就是介绍MySQL数据库的预处理(prepared statement)性能测试的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

mysql怎么创建数据表

mysql的一些功能实用的linux shell脚本分享

mysql触发器在php项目中用来做信息备份、恢复和清空

mysql如何查询索引状态?

mysql多表关联更新

mysql导入数据时出现乱码怎么办

mysql连接不到本地数据库怎么办

详解mysql基本查询、连接查询、子查询、正则表达查询

mysql数据库服务找不到怎么办

mysql如何设置数据表的默认编码格式

更多相关阅读请进入《mysql》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...