Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django database connections pool with psycopg2.pool

I'm trying to implement persistent database connection pool with django. One of the options is to use built in psycopg2.pool code which provide different types of pools (PersistentConnectionPool, ThreadedConnectionPool etc ), but there is no psycopg2 documentation on that topic.

So, do anyone done any work in this direction or have some working code? I just don't want to reinvent the wheel.

Thanks.

like image 647
HardQuestions Avatar asked Mar 19 '26 01:03

HardQuestions


1 Answers

Django has no support for connection pooling. Technically you could probably write a django db backend that used psycopg2, but I think you'd be much better off using an external process for connection pooling. Take a look at pgpool for this.

like image 55
Alex Gaynor Avatar answered Mar 21 '26 19:03

Alex Gaynor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!