Skip to content

Docs clarification about psycopg[c] #1195

@adamsol

Description

@adamsol

In my team, we've had a similar discussion as in django/djangoproject.com#2215, django/djangoproject.com#2212 (comment), or django/djangoproject.com#2212 (comment).

Currently, the documentation says:

A “Local installation” results in a performing and maintainable library. The library will include the speed-up C module and will be linked to the system libraries (libpq, libssl…) so that system upgrade of libraries will upgrade the libraries used by Psycopg 3 too. This is the preferred way to install Psycopg for a production site.

suggesting that the [c] version is considerably better than [binary] (which doesn't have those nice adjectives in its description). In reality, I find no performance difference, which is also confirmed in django/djangoproject.com#2212 (comment). And the "maintainability" part is quite difficult to assess. Some issues with openssl were mentioned in #1156 (comment), but it seems this is no longer a problem.

Could the docs be more specific about how much better the local installation actually is for a production site? As most Python packages relying on compiled extensions are distributed with pre-built binaries, I still (despite having read all the linked comments) find it difficult to understand why psycopg should be the only one requiring GCC and all the other dependencies. For example, are the advantages enough to justify installing different versions in dev and prod environments, possibly risking some inconsistent behavior?

Of course, I mean the case when binary installation is available for our system. If it's not, then there's no decision to make.


Bonus question: is it expected that installing psycopg[c] takes way more time than it did for psycopg2, even though they both require compilation? It's actually one of the main reasons for me to avoid this version, as admins installing/upgrading the application may think the process is stuck.

Installation time comparison
> time pip install psycopg2
...

Successfully installed psycopg2-2.9.11

real    0m8.050s
user    0m6.452s
sys     0m1.307s
> time pip install psycopg[c]
...

Successfully installed psycopg-3.2.12 psycopg-c-3.2.12

real    0m28.106s
user    0m26.093s
sys     0m1.646s

Interestingly, it was even 2 times slower not so long ago:

> time pip install psycopg[c]==3.2.9
...

Successfully installed psycopg-3.2.9 psycopg-c-3.2.9

real    0m56.894s
user    0m54.169s
sys     0m2.329s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions