databasedjangoconnectionpersistencepool

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.


Solution

  • 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.