Which of the following is better performance for PDO, MySQL, and mysqli? Here we will make a simple comparison.
Normal MySQL connections will certainly be discarded because every time SQL injection is prevented, it is relatively slow.
Mysqli is an optimization based on normal mysql. To be honest, it is very successful. The pre-processing method completely solves the problem of SQL injection. However, the only disadvantage is that only MySQL databases are supported. Of course, if you do not operate other databases, this is undoubtedly the best choice.
PDO is the latest one. The connection method is compatible with most databases and also solves SQL injection. But it also has some disadvantages. It only supports PhP5 and later versions (but I heard that PhP6 will only support this connection in the future ).
PDO unifies all database abstraction layer object interfaces, and MySQL only unifies MySQL. To put it simply, PDO can implement the sameCodeOperations on different databases, such as migrating from MySQL to MSSQL,ProgramIt basically does not need to be changed. Mysqli simply understands that MySQL is not encapsulated.
When a persistent connection is enabled for a PDO instance under high load, a relatively stable load value is obtained ". However, the efficiency is not the highest. MySQL is the fastest. Mysqli followed. It's just that when MySQL and mysqli are in high concurrency and high system load, their load is also considerable. PDO does not.