Re: PDO fetch performance problems with many bind parameters
| From: | Dino Pejaković | Date: | Fri, 28 Aug 2020 13:51:39 +0000 |
| Subject: | Re: PDO fetch performance problems with many bind parameters | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111704@lists.php.net to get a copy of this message | ||
The script I used to pinpoint this problem and test my temporary fix, and later Matteo's PR is linked in the bug report I oppened. Should be simple to run if anyone is interested in trying. I found this on pdo_pgsql, but looking at the code it looks like the problem should happen on other pdo_* drivers too, I can do more tests if it matters.
On 28. 08. 2020. 14:50, Gabriel Caruso wrote:
On Fri, 28 Aug 2020 at 09:19, Matteo Beccati <php@beccati.com> wrote:Hi George, /cc release managers - pls don't hate me ;-) On 27/08/2020 10:23, Matteo Beccati wrote:Hello Matteo Let's have this patch merged into PHP 8.0 (On 26/08/2020 19:28, G. P. B. wrote:please benchmark it and get back with results?> > https://github.com/php/php-src/pull/6047 The PR seems to fix the issue: https://bugs.php.net/bug.php?id=80027 Dino's bench script takes 3s on vanilla PHP8 and 120ms with the patch, so it's seems a fairly good win. The fetching part alone goes down from 2.9s to 3ms. The way it's been fixed should be backwards and forwards compatible with no real need to bump PDO_VERSION_API: external PDO driver extensions wanting to use the param_evt_skip flags could simply set them via a preprocessor macro when compiled for PHP8+. For now I've optimised the pdo_pgsql/mysql/sqlite extensions, but I will look into the other bundled ones too. Would you think it's sensible to treat this as a bug fix and target 7.3+? Or is it better to do PHP8 only? Or? Cheers -- Matteo Beccati Development & Consulting - http://www.beccati.com/This can still target PHP 8.0 as this seems to be akin to a bug this might even be applicable to PHP 7.3/7.4. Anyways, good catch.You could be right. I've created a draft PR for review: Dino could yo>masterbranch as of today), I have nothing against it. About PHPs 7.3 and 7.4: if the performance improvements are this massive as describe in this email, I'm :+1: to have it on those versions as well. Kind regards,