Skip to content

Transaction pooling is not possible with prepared statements #2327

Open
@lastmjs

Description

@lastmjs

As I've been digging into proxying requests to postgres because of large serverless load, I've come to realize that transaction pooling with node-postgres does not seem possible for prepared statements. The two major types of proxies that I've studied are AWS RDS Proxy for Postgres and pgBouncer. Neither seem to support prepared statements in the way that node-postgres executes them. If I am wrong and there is any way to currently achieve transaction pooling with node-postgres, please let me know. This seems a major roadblock for certain types of highly-scalable applications, such as serverless applications.

There may be a possible solution as hinted to here: #2266 and in this blog post: https://blog.bullgare.com/2019/06/pgbouncer-and-prepared-statements/

Until something like the above is implemented in pg, I don't believe transaction pooling is possible with prepared statements. You might say just not to use prepared statements, but they are widely used and I believe quite vital. For example, I use the Graphback project which uses Knex under-the-hood. Knex uses prepared statements for every query. There is no easy way for me to remove these dependencies from my application, it would take a major architectural overhaul.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions