psycopg2-pool
Proper pooling of psycopg2 connections
Decision gist · record as of 2026-08-14
Yes, if you are building a multi-threaded Python application that queries PostgreSQL frequently. The package is simple, has low install friction, carries no known vulnerabilities, and solves a real problem. The dormant maintenance status is a minor concern—monitor for breaking changes in psycopg2 or PostgreSQL—but the code is stable. Be aware of the LGPL3 copyleft license if your application is proprietary.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires psycopg2-binary installed; application must manage connection lifecycle (getconn/putconn calls).
- Low friction: pure Python wheel with a single runtime dependency on psycopg2-binary.
- Maintenance is dormant—last commit was 2024-05-10—but the package is marked Production/Stable.
License · maintenance · safety
LGPL3 (copyleft) — Licensed under LGPL3 (copyleft). Any application that links this library must make its own source code available under a compatible license or comply with LGPL3's linking exceptions.
last release 2024-01-15 (942 days) · last repo commit 2024-05-10 · 4 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 311,370 downloads/mo, #7,735 on PyPI
Alternatives
Verify before relying
pip install psycopg2-pool
from psycopg2_pool import ThreadSafeConnectionPool
pool = ThreadSafeConnectionPool(1, 10, "dbname=test user=postgres")
conn = pool.getconn()
# use conn
pool.putconn(conn)- Whether the dormant maintenance status (942 days since latest release) poses a risk for future PostgreSQL or psycopg2 compatibility.
- Performance characteristics and overhead compared to other pooling solutions.
- Specific threading model and concurrency limits of ThreadSafeConnectionPool.
What it is and what it does
psycopg2-pool wraps psycopg2 to provide thread-safe connection pooling for PostgreSQL. Instead of opening and closing a new database connection for each request—an expensive operation—the pool maintains a set of open connections that applications can borrow and return, reducing latency and resource consumption in concurrent workloads.
The package exports a ThreadSafeConnectionPool class that manages a minimum and maximum number of connections, handing them out on demand and recycling them back into the pool. It is designed for multi-threaded Python applications that make frequent database queries and need to amortize connection setup costs. The library depends only on psycopg2-binary and installs as a pure Python wheel.
Use it for
- Web applications serving concurrent requests that each need a database connection.
- Multi-threaded batch processing jobs that query PostgreSQL repeatedly and need to avoid connection exhaustion.
- Long-running services that spawn worker threads and need a shared, thread-safe pool of database connections.
- Testing frameworks that run parallel test suites against a shared PostgreSQL database.
- Applications requiring reduced connection setup latency in high-concurrency scenarios.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are building a multi-threaded Python application that queries PostgreSQL frequently.
The package is simple, has low install friction, carries no known vulnerabilities, and solves a real problem. The dormant maintenance status is a minor concern—monitor for breaking changes in psycopg2 or PostgreSQL—but the code is stable. Be aware of the LGPL3 copyleft license if your application is proprietary.
Install
psycopg2-pool on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency on psycopg2-binary. Maintenance is dormant—last commit was 2024-05-10—but the package is marked Production/Stable.
Requires psycopg2-binary installed; application must manage connection lifecycle (getconn/putconn calls).
License in practice
Licensed under LGPL3 (copyleft). Any application that links this library must make its own source code available under a compatible license or comply with LGPL3's linking exceptions.
Quickstart
pip install psycopg2-pool
from psycopg2_pool import ThreadSafeConnectionPool
pool = ThreadSafeConnectionPool(1, 10, "dbname=test user=postgres")
conn = pool.getconn()
# use conn
pool.putconn(conn)
Verify before relying
- Whether the dormant maintenance status (942 days since latest release) poses a risk for future PostgreSQL or psycopg2 compatibility.
- Performance characteristics and overhead compared to other pooling solutions.
- Specific threading model and concurrency limits of ThreadSafeConnectionPool.
Package facts
| License | LGPL3 copyleft |
| Python support | Supports the current Python release >=3.3 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepsycopg2-binary |
| Maintenance | Dormant 942 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 311,370 / month, #7,735 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python |
Evidence: psycopg2_pool-1.2-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “psycopg2 connection pooling”
- psycopg2-poolManages a pool of reusable PostgreSQL connections via psycopg2,…
- queriesQueries is a simplified wrapper around psycopg2 that provides a…
- aiopgaiopg provides asyncio-based access to PostgreSQL databases, wrapping…
Give your agent the search over MCP, or paste the wish link into any chat.
More Database packages
psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.
Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.
Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.
YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.
Install it if you need to connect Python applications to YDB databases.
Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.
sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.
Install it if you need to manipulate, format, or analyze SQL text programmatically.
Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.
See also DBUtils · postgres · psycopg-pool · queries · pgcopy · django-db-connection-pool · clickhouse-pool · django-db-geventpool · connection_pool · psycopg2