mysql icon indicating copy to clipboard operation
mysql copied to clipboard

Connection pool

Open anarthal opened this issue 5 years ago • 1 comments

Provide a mechanism to create a connection pool to re-use existing connections.

anarthal avatar Nov 29 '20 17:11 anarthal

From the review: prepared statements are allocated at the connection level. When taking a connection from the pool, preparing some statements, using them and then returning a connection to the pool without closing it, those statements may be leaked if prepared_statement::close is not called. When implementing this, we should create some mechanism that stores which statements have been prepared by which connection, so they can be closed when the connection is returned to the pool. We may want to close those statements by server-side ID (as returned by prepared_statement::id(), vs. by using the prepared_statement object), and in batch.

anarthal avatar May 18 '22 21:05 anarthal

Connections that are iddle for too long are automatically closed by MySQL (see #161). The pool should provide an option for auto-keepalives after a certain period has elapsed.

anarthal avatar Jun 11 '23 15:06 anarthal

Is there any plan to support connection pooling in the future? Will this feature be implemented only after 'std:: execution' is supported?

banderzhm avatar Aug 25 '23 07:08 banderzhm

Sorry for the late reply. Yes, there is. I hope to get it in 1.84.

anarthal avatar Aug 29 '23 10:08 anarthal

That's great!

banderzhm avatar Sep 13 '23 03:09 banderzhm

Closed by bc5577ede56204770fb35c296cdeb21c3c772a36 (typo in commit message prevented auto close).

anarthal avatar Dec 26 '23 17:12 anarthal