Re: Change Request: Make PDO default to not emulate prepared statements for MySQL
| From: | Ferenc Kovacs | Date: | Sat, 30 Apr 2011 15:45:09 +0000 |
| Subject: | Re: Change Request: Make PDO default to not emulate prepared statements for MySQL | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52101@lists.php.net to get a copy of this message | ||
On Sat, Apr 30, 2011 at 5:39 PM, Rasmus Lerdorf <rasmus@lerdorf.com> wrote:
> On 04/30/2011 08:13 AM, Anthony Ferrara wrote:
>
>> I have already reported this issue on the bug tracker:
>> http://bugs.php.net/bug.php?id=54638
>>
>> But I figured it would be good to start a discussion on it here. To
>> me, I consider this a pretty significant issue since it's not possible
>> to do true prepared statements while using PDO. All the code to do so
>> is there (and it does work). But it's just the single flag that
>> defaults emulation to be on that's holding things up.
>>
>> Since it will fallback to using emulation mode if the library or
>> server can't support prepared statements, I don't personally see any
>> issue with changing the default in a point release.
>>
>
> Do you realize why we did this in the first place? The common versions of
> MySQL in use out there are not very clever when it comes to the native
> prepared statement handling. First, there is no prepared statement cache, so
> there is no benefit to doing them natively, but worse, when you use a native
> prepared statement you completely miss the query result cache. As a result
> emulated prepared statements are either the same speed or faster than the
> native ones. Changing this default would result in a performance hit for
> most people. It should be better documented, but that is the only problem I
> see here.
>
>
I disable query_cache on my machines, because it can cause performance and
stability issues.
http://www.mysqlperformanceblog.com/2011/04/10/should-we-give-a-mysqlquery-cache-a-second-chance/
Tyrael