PHP PDO与常规mysqli速度性能基准 [英] PHP PDO vs normal mysqli speed performance benchmark

查看:73
本文介绍了PHP PDO与常规mysqli速度性能基准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事有关社交网站的项目,在该项目中,速度优化至关重要.

PDO更快吗?

我正在考虑切换到PDO,建议在这样的网站上使用PDO吗?

解决方案

我怀疑使用PDO或MySQLi会成为瓶颈,但是,如果您要使用标记,请 解决方案

I doubt using PDO or MySQLi will be bottleneck, though, if you ask for bechmarks, here they are (nothing serious, just couple of tests).

In general, using one or another is a matter of taste, and bottlenecks usually are somewhere else (e.g., queries, indexes, PHP code etc).

One thing you might consider is using some DB wrapper, i.e., class that uses either PDO or MySQLi, whichever you prefer. In your code, use this wrapper instead of using PDO or MySQLi directly. If you do this, you'll be able to switch between PDO, MySQLi or any other library by changing single class instead of changing all the code.

这篇关于PHP PDO与常规mysqli速度性能基准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆