Analysis of mysql, mysqli, PDO

Source: Internet
Author: User

Analysis of mysql, mysqli, PDO, MYSQL, MYSQLI performance which is better? 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 perform operations on different databases using the same Code. For example, if you migrate data from mysql to mssql, the program does not need to be modified. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.