Skip to content

pq library alternatives. #59

Description

@georgysavva

As I can see from your docs, you propose to use the pq library to connect to Cockroachdb from the application.
After looking at this library I found several major issues in my opinion:

  1. It doesn't support read/write timeouts, only connection timeout. So if we get a connection from the pool and network failed the query will hang because we don't have read timeouts.
    I found an open issue for this problem: Support read timeout for queries lib/pq#450 it was opened 4 years ago and they still didn't do anything. Another guy did a PR Added read_timeout and write_timeout lib/pq#792 but maintainers didn't react on it in a year.
    Another postgers library supports such timeouts: https://github.com/go-pg/pg

  2. Another issue with the pq, is that if you want to timeout your queries via the context cancel mechanism, it will try to send a cancel request to the server and if it's unreachable it will, again, hang. Here is the opened issue in this regard (3 years old):
    Context cancel hangs if there is no network connectivity lib/pq#620

I think it goes against the highly available and distributed nature of the CockroachDB.
Maybe there are some side car proxies that one can use to offload this timeout logic from the library. Like envoy for http.
So that is your advice in that regard ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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