note 79178 added to function.PDO-prepare
| From: | Stan at osu1 dot php dot net | Date: | Wed, 14 Nov 2007 15:35:00 +0000 |
| Subject: | note 79178 added to function.PDO-prepare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132273@lists.php.net to get a copy of this message | ||
Using prepared SELECT statements on a MySQL database prior to MySQL 5.1.17 can lead to SERIOUS
performance degradation.
Quote from http://dev.mysql.com/doc/refman/5.1/en/query-cache.html
:
>> The query cache is not used for server-side prepared statements before MySQL 5.1.17
>> <<
The MySQL query cache buffers complete query results and is used to satisfy repeated identical
queries if the underlying tables do not change in the meantime - just what happens all the time in a
typical web application. It speeds up queries by a several hundred to a several thousand percent.
Obviously, it doesn't make much sense to give up query caching for the relatively small
performance benefit of prepared statements (i.e. the DBMS not having to parse and optimize the same
query multiple times) - so using PDO->query() for SELECT statements is probably the better choice
i you're connecting to MySQL < 5.1.17.
----
Server IP: 217.13.201.10
Probable Submitter: 217.184.142.46
----
Manual Page -- http://www.php.net/manual/en/function.PDO-prepare.php
Edit -- https://master.php.net/note/edit/79178
Del: integrated -- https://master.php.net/note/delete/79178/integrated
Del: useless -- https://master.php.net/note/delete/79178/useless
Del: bad code -- https://master.php.net/note/delete/79178/bad+code
Del: spam -- https://master.php.net/note/delete/79178/spam
Del: non-english -- https://master.php.net/note/delete/79178/non-english
Del: in docs -- https://master.php.net/note/delete/79178/in+docs
Del: other reasons-- https://master.php.net/note/delete/79178
Reject -- https://master.php.net/note/reject/79178
Search -- https://master.php.net/manage/user-notes.php