--- id: psycopg-c version: "3.3.4" license: LGPL-3.0-only license_treatment: copyleft maintenance: active --- # psycopg-c — PostgreSQL database adapter for Python -- C optimisation distribution License: copyleft · Maintenance: active · Downloads: 943.6K/mo ## What it is and what it does psycopg-c is an optional compiled extension for Psycopg 3, the PostgreSQL database adapter for Python. It is not a standalone package but rather a performance-optimization layer that sits on top of the main adapter library. When installed, it replaces certain hot-path Python functions with C-compiled equivalents to reduce overhead during database operations. The package is distributed separately because compilation requires build tools and system libraries that not all environments have available. The documentation explicitly recommends installing it via `pip install "psycopg[c]"` rather than directly, so that the version stays synchronized with your installed adapter version. If compilation fails due to missing prerequisites, the fallback is `psycopg[binary]`, which provides pre-built wheels. Use it for: - Accelerate database queries in production applications where round-trip latency or data marshalling is a bottleneck. - Reduce CPU overhead in high-throughput data pipelines that execute many small queries or process large result sets. - Optimize long-running ETL jobs that rely on the adapter for bulk data movement between PostgreSQL and Python. - Speed up applications by compiling the adapter layer to reduce interpreter overhead. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. psycopg-c is an optional C-compiled optimization package for Psycopg 3 that speeds up database operations by replacing pure-Python components with compiled extensions. Yes, if you have a C compiler and PostgreSQL development headers available and are using Psycopg 3 in a performance-sensitive application. Install via `pip install "psycopg[c]"` to keep versions synchronized. If compilation fails, fall back to `pip install "psycopg[binary]"` instead. The LGPL-3.0-only license requires source disclosure if you distribute the linked software, so verify your deployment model first. ## Install pip install psycopg-c uv add psycopg-c poetry add psycopg-c ## Installing psycopg-c Before you install: Installation has high friction: it requires a C compiler and library headers to build from source. The package is actively maintained (last commit 2026-08-01, 105 days since release), but you should only install this directly if you understand the build prerequisites—the documentation recommends using `pip install "psycopg[c]"` instead, or falling back to `psycopg[binary]` if compilation fails. License in practice: Licensed under LGPL-3.0-only (copyleft). If you distribute software that links this package, you must make your source code available under compatible terms; static linking or bundling may trigger copyleft obligations depending on your deployment model. Quickstart: pip install "psycopg[c]" import psycopg conn = psycopg.connect("postgresql://user:password@localhost/dbname") Requires a C compiler (gcc, clang, MSVC) and PostgreSQL development headers (libpq-dev or equivalent) installed on your system. If these are unavailable, use `pip install "psycopg[binary]"` instead. Verify before relying: - Whether the C extension provides measurable performance gains for typical workloads compared to pure-Python alternatives. - Whether pre-built binary wheels are available for your platform, or if local compilation is always required. - How the package integrates with higher-level database libraries and ORMs. ## Package facts - License: LGPL-3.0-only (copyleft) - Python support: supports_current - Install friction: high - Maintenance: active - Downloads: 943.6K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags psycopg c extension, postgresql python performance, psycopg optimization, compiled database adapter, psycopg speedup, postgresql c bindings, psycopg3 performance boost, performance-optimization, c-extension, postgresql [View on SkillFed](https://skillfed.io/packages/psycopg-c) · [View on PyPI](https://pypi.org/project/psycopg-c/)