tags:

views:

64

answers:

1

Recently I was going through a blog and noticed some points about using PDO in mysql and it changed my view about the PDO. The points are :

* native prepared statements cannot take advantage of the query cache, resulting in lower performance.
* native prepared statements cannot execute certains types of queries, like "SHOW TABLES"
* native prepared statements don't correctly communicate column lengths for certain other "SHOW" queries, resulting in garbled results.
* calling stored procedures multiple times using native prepared statements causes the connection to drop.

Can anyone comment on this please?

I wanted query cache in my web app. I am preparing to move my web app to make use of PDO after considering performance issues with my website. Can anyone please suggest me?

Thanks in advance.

+3  A: 

Well

  • you are right for the first point
  • The SHOW and SHOW TABLES are commands not commonly used in most use cases
  • Iam using prepared statemends in combination with stored procedures and have not yet experienced such problems.

You may use the following command to enable query caching:

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

This command is available from PHP 5.1.3 on only.