On Fri 8 Aug 2025, 19:32 Robert Wolf, <rpo...@gmail.com> wrote:

> Persistent connection helps avoid the overhead involved in creating and
>> authorizing a new connection on the server.
>>
>
> That only applies if you are creating multiple PDO objects and expecting
> re-use of the kept-alive underlying connection, correct?
>
> If persistent connections were removed, it is true that any users
> utilizing PDO in this ad-hoc fashion and expecting connection keepalive
> would be impacted. Granted, that potential impact may not be tenable, but
> the workaround would seem rather straightforward to communicate to users
> and to implement - that workaround being for the user to introduce a PDO
> singleton to hold the object reference as long as you wish the connection
> to live for.
>


No, They are reusable across different http requests. There's no point in
reusing them in the same request.

On the first access to the website a new connection is established. On the
second access the same connection is reused provided the first request is
done with it. This way consecutive requests to the website do not need to
open a new costly connection.

>

Reply via email to