Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71636 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85945 invoked from network); 27 Jan 2014 12:12:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jan 2014 12:12:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@hristov.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@hristov.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hristov.com from 91.196.124.214 cause and error) X-PHP-List-Original-Sender: php@hristov.com X-Host-Fingerprint: 91.196.124.214 more.superhosting.bg Linux 2.6 Received: from [91.196.124.214] ([91.196.124.214:55728] helo=more.superhosting.bg) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 31/14-12631-71D46E25 for ; Mon, 27 Jan 2014 07:12:09 -0500 Received: from [87.121.162.109] (port=54757 helo=[192.168.20.117]) by more.superhosting.bg with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80.1) (envelope-from ) id 1W7l2q-001MwF-Eu for internals@lists.php.net; Mon, 27 Jan 2014 14:12:04 +0200 Message-ID: <52E64D10.5020404@hristov.com> Date: Mon, 27 Jan 2014 14:12:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: <52E29253.2000801@lsces.co.uk> <52E2924B.6080002@ajf.me> <52E299D4.6040102@garfieldtech.com> <52E2C98C.6010005@lerdorf.com> <52E2D8D2.80106@lerdorf.com> In-Reply-To: <52E2D8D2.80106@lerdorf.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - more.superhosting.bg X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - hristov.com X-Get-Message-Sender-Via: more.superhosting.bg: authenticated_id: php@hristov.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] Ruminations on PHP 5++ From: php@hristov.com (Andrey Hristov) On 24.01.2014 23:19, Rasmus Lerdorf wrote: > On 1/24/14, 1:03 PM, Arvids Godjuks wrote: >> The PDO. This is something that needs so much improvement that it's >> ridicilous it has survived till this time. I use Yii framework as my tool, >> they use PDO as their base. I have considered many times to integrate a >> mysqli to PDO wrapper to bring things like mysqli_ping, unbuffered queries >> and lost more. At this point I can do without those things because I do not >> have a lot of load on my projects, but they are growing and at some point >> abandoning the PDO will be a nesesity due to it's lack of features. >> I think PDO is a bad idea for PHP as a whole. We are better of with a >> consisten API through the native drivers and maybe a PDO like thing that >> gives us data objects, but still provides ability to get to the low level >> stuff that is sometimes needed. PHP lately has moved to projects that >> previosly where done on Java and some other move advanced tech. And lack of >> frameworks using the native drivers is kind'a bad, because in really >> advanced projects you have to create your own framewok... > > But note, if you blindly switch from PDO to mysqli, which in turn > usually means moving from client-side prepares to server-side prepares, > chances are you are going to take a significant performance hit. Like I > said, it means two extra network roundtrips per sql query and for one > large project I worked on that meant an extra 40ms latency per web request. in the case most of the queries happen to be prepared over and over again there is some solution to this : http://svn.php.net/viewvc/pecl/mysqlnd_pscache/trunk/ It plays with persistent connections, doesn't close them and when a PS is tried to be prepared and is on the same connection there is no round-trip and the PS is reused. Of course, all problems of pconns stay. It's more of a PoC but in simple tests it worked. > So I don't think PDO is a bad idea. Having a single source of common > functionality needed by all DB drivers makes sense. Imagine if every > lower-level driver needed to implement their own client-side prepare > feature? And a consistent API across the low-level drivers isn't > feasible since each DB has a lot of specialization. It would end up > looking exactly like PDO but with a bunch of special calls for each one. > If you could bounce back and forth between PDO and the lower-level > driver easily you get the consistent API and you get access to all the > lower-level features. Also, from a migration point of view, scrapping > PDO and rewriting all the low-level drivers to be "consistent" would be > an absolute nightmare. > > -Rasmus > Best, Andrey