Re: PDO Disconnect and Persistent Connect
| From: | Kamil Tekiela | Date: | Fri, 08 Aug 2025 14:59:10 +0000 |
| Subject: | Re: PDO Disconnect and Persistent Connect | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-128438@lists.php.net to get a copy of this message | ||
>
> The added complexity of the feature seems to outweigh the benefits, which
> as best I can gather, is primarily to allow for ad-hoc PDO object creation.
> If that is truly all it brings in benefit, this is a use case easily
> supported by the user via singleton.
>
The primary benefit and use case is for slow network connections between
PHP and MySQL. Persistent connection helps avoid the overhead involved in
creating and authorizing a new connection on the server.
The main disadvantage is the confusion it brings to an average user who has
to be aware of many pitfalls that come with reusable connections.
>