PDO in mysql performance

I recently went through a blog and noticed some points about using PDO in mysql, and it changed my mind about PDO. Points:

  • Own prepared statements cannot use the query cache, which leads to poor performance.

  • Native prepared statements cannot execute type certificate types, such as "SHOW TABLES"

  • Own prepared statements incorrectly report column lengths for some other SHOW queries, resulting in garbled results.

  • Calling stored procedures several times using built-in prepared statements causes the connection to fail.

Can anyone comment on this?

I need a query cache in my web application. I am ready to move my web application to use PDO after addressing performance issues on my website. Can anyone suggest me?

Thanks in advance.

+5
source share
2 answers

Well

  • you are right for the first point
  • SHOW and SHOW TABLES are commands that are not commonly used in most use cases.
  • Iam using ready-made statemends in combination with stored procedures and have not yet encountered such problems.

You can use the following command to enable query caching:

$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);

This command is only available with PHP 5.1.3.

+5
source

Prepared DO statements use a query cache, but it has conditions:

5.1 Doc:

MySQL 5.1.17 . 5.1.17, , :

  • , mysql_stmt_prepare() mysql_stmt_execute().
  • , () PREPARE EXECUTE. . 12.6 " SQL ".

5.5 :

, mysql_stmt_prepare() mysql_stmt_execute(), . ? . , . , , , .

+2

All Articles