I’m building a web app in Python (using Flask). I do not intend to use SQLAlchemy or similar ORM system, rather I’m going to use Psycopg2 directly.
Should I open a new database connection (and subsequently close it) for each new request? Or should I use something to pool these connections?
PgBouncer is pretty neat and transparent to the application and server.
We have been using PgBouncer in production for 2 years without a single issue. It’s a pretty awesome PostgreSQL connection pooler.
http://wiki.postgresql.org/wiki/PgBouncer