Home » Php » PHP PDO vs normal mysqli speed performance benchmark

PHP PDO vs normal mysqli speed performance benchmark

Posted by: admin July 12, 2020 Leave a comment

Questions:

i m working on a project about social networking website where speed optimization is very critical.

is PDO is FASTER ?

i am thinking to switch to PDO is it recommended for use PDO for such a site ?

How to&Answers:

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.

Answer:

I did a mini benchmark on this a while back. Conclusion. PDO and MySQLi are very similar but the features in PDO are worth using.

http://cznp.com/blog/2/apples-and-oranges-mysqli-and-pdo