Are prepared statements cached server-side across multiple page loads with PHP?

后端 未结 7 1039
感动是毒
感动是毒 2020-12-09 17:55

I learnt about prepared statements when making a JDBC-enabled Java application, and my app uses a connection pooling layer that assures me that prepared statements are cache

7条回答
  •  旧巷少年郎
    2020-12-09 18:05

    The only true answer is it depends.

    Prepared statements are finicky beasts when it comes to MySQL. There are a great number of factors that determine whether or not a prepared statement is cached.

    The general idea is if your version is < 5.1.17, the prepared statement is never cached in the query cache, and if using >= 5.1.17, it depends.

    Please see the following page in the MySQL 5.1 manual:

    http://dev.mysql.com/doc/refman/5.1/en/query-cache-operation.html

提交回复
热议问题