Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52099 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85098 invoked from network); 30 Apr 2011 15:39:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2011 15:39:13 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.210.42 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.210.42 mail-pz0-f42.google.com Received: from [209.85.210.42] ([209.85.210.42:33180] helo=mail-pz0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/2C-10915-02D2CBD4 for ; Sat, 30 Apr 2011 11:39:13 -0400 Received: by pzk37 with SMTP id 37so2729025pzk.29 for ; Sat, 30 Apr 2011 08:39:10 -0700 (PDT) Received: by 10.68.41.234 with SMTP id i10mr7204609pbl.345.1304177950258; Sat, 30 Apr 2011 08:39:10 -0700 (PDT) Received: from [192.168.200.140] (c-76-126-236-132.hsd1.ca.comcast.net [76.126.236.132]) by mx.google.com with ESMTPS id n4sm2627477pbj.97.2011.04.30.08.39.09 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 30 Apr 2011 08:39:09 -0700 (PDT) Message-ID: <4DBC2D1B.10302@lerdorf.com> Date: Sat, 30 Apr 2011 08:39:07 -0700 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110419 Thunderbird/3.1.9 MIME-Version: 1.0 To: Anthony Ferrara CC: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Change Request: Make PDO default to not emulate prepared statements for MySQL From: rasmus@lerdorf.com (Rasmus Lerdorf) 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. -Rasmus