Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9197975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:11:14+00:00 2026-06-17T22:11:14+00:00

I have no idea how PDO’s connection pooling works, and I’m getting nowhere with

  • 0

I have no idea how PDO’s connection pooling works, and I’m getting nowhere with searches.

First, for clarity, is PDO’s connection pooling automatic?

If not, how can I utilize it on an AJAX page?

I’ve clocked the time cost on my local wampserver dev of making a database connection via mysqli at 10ms per, and I’m trying to drive wait times as close to 0 as possible. This is one of my last issues.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:11:15+00:00Added an answer on June 17, 2026 at 10:11 pm

    If you are talking about persistent connections look here: http://php.net/manual/en/pdo.connections.php

    Do persistent connections remain open across different AJAX requests?

    Yes and the risk that they are never reused. Thanks to @carefulnow. I’ll quote his comments here:

    Persistent connections and connection pooling are not the same thing
    Connection pooling creates a lot of connections to start with, and then the application just grabs one of those already established connections. Persistent connections do establish new connections, but they do not close unless explicitly told to (a normal connection will close at the end of the script). Persistent connections are dangerous if not used carefully, as most databases implement a maximum connections count, and will refuse further connections when hit. For most cases, a normal connection (just calling the PDO constructor with a DSN and login details) will be fine.

    I’ll explain it by showing the PHP code, and the resulting connection count in the MariaDB console monitor. Look at the following screenshots, and pay attention the the "run count" in the bottom right. You’ll see when using persistent connections, connections do not close, but instead go into sleep mode. Ignore connection #231, that’s the console monitor’s. https://i.stack.imgur.com/UkCjN.png, https://i.stack.imgur.com/vXaGQ.png, https://i.stack.imgur.com/gUlGA.png. As you can see, the time column indicates the length of inactivity, not the length of time connected, hence the console monitor’s time is always zero, because I’ve just executed SHOW PROCESSLIST;. I hope this clears everything up a bit, database connection management is quite tricky sometimes.

    So looking at the screenshots the questions is open, how to pickup these persistent connections again. Some answers on StackOverflow say, that they are cached on thread level, so if you have more than one thread (which is highly expected) than you get many connections. This opens the risk to run into the connection limit of mysql. Before using persistant connections make sure you understand how they work (which I don’t, but it seems @carefulnow :-))

    Is it possible to set a persistent connection to expire?

    PHP doc says they are cached, therefore I assume they are cleanup after a time.

    More on the php doc

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can any body have idea how to consume php soap web service that have
I want to install PDO driver for MySQL but have no idea how to.
First of all, I'm using PDO. I believe it can be done using prepare
Hi is anyone have idea . from where i can get the list of
Anyone have idea about how to bind Boolean in sqlite with objective - c.
I have idea to write errors from my application to the Windows Event Viewer
Anyone have idea how to pass value from iPhone application to the REST-Webservice using
Any body have idea how to put controls dynamically in asp.net 3.5 ? if
I missed my workspace in which I was working. Any one have idea about
I have an idea for a functional programming language design that makes heavy use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.