Saturday, December 14, 2024

Does anyone use client connectors for PostgreSQL ?

 Recently, I attended a conference talk about the vibrant ecosystem of PostgreSQL. It was a fascinating presentation, showcasing the incredible breadth of innovation in the PostgreSQL community. Extensions that push the boundaries of functionality, AI integrations within PostgreSQL, advanced connection pools, and robust cluster management tools were all highlighted.

But something vital was conspicuously absent. Can you guess? That’s right—not a single mention of client connectors.

Let’s pause for a moment and consider this: without clients to connect to PostgreSQL, how do you actually use any of these features?

Of course, one could argue, “We have libpq!” True, libpq is a core PostgreSQL client library written in C. However, most modern enterprise applications aren’t developed in C or C++—they’re built in higher-level languages like Java, Python, or .NET. That’s where the ecosystem of client connectors becomes indispensable.

Now, I’ll admit, I’m a bit biased. Having worked on the PostgreSQL JDBC driver for over 24 years, my perspective may naturally lean toward this critical layer of the stack. But that bias only drives my curiosity. So, I decided to do a little research.

Here’s what I found—a snapshot of the client connectors ecosystem, complete with the number of lines of code for each project:

Project            Lines of Code Language
psqlodbc            112,886            C++
psycopg             52,970              Python
pgx                     52,905             Go
crystal-pg           3,858               Crystal
node-postgres    18,838             Node.js
rust-postgres      10,448             Rust
pgjdbc                168,541           Java
npgsql                74,944             C#
pg                       12,625            Go
py-postgres        23,576            Python
postgres-gorm    1,198             Go
deno                   10,392           TypeScript
ruby-pg              22,008           Ruby
PostgresDAC    108815           C++ Delphi

That’s a grand total of 701,991 lines of code across 14 projects. To put this into perspective, PostgreSQL itself has about 1.3 million lines of code. The sheer volume of code dedicated to connecting applications to PostgreSQL is staggering, and yet client connectors often receive little visibility or recognition within the community.

Why is that? I’m not sure, but I can’t help but wonder. Considering their importance in making PostgreSQL accessible to a broad range of developers and applications, shouldn’t client connectors get a bit more love?