apache / apache/arrow-adbc

Initial connection to postgres very slow when number of OIDs is large

Open
#1,755 37 comments 0 reactions 1 assignee Claimed by @Mandukhai-Alimaa View on GitHub
Type: bug
Dominant language
C#
Stars
627
Forks
217
Avg merge
17h
Merged PRs (30d)
57

Description

### What happened?

When I perform a `dbapi.connect(uri)` call to a postgres 9.4.26 database (Greenplum 6.24.3), it takes upwards of two minutes to connect. Compare this to SQLAlchemy which connects in about one second:

```python
from time import perf_counter

import sqlalchemy as sa
from adbc_driver_postgresql import dbapi

uri = "..."

# using SQLAlchemy
t = perf_counter()
conn = sa.create_engine(uri).connect()
print(f"SQLAlchemy connected in {perf_counter() - t:0.2f}s.")

# verify result
print(conn.execute(sa.text("SELECT 1")).fetchall())
conn.close()

# using adbc
t = perf_counter()
conn = dbapi.connect(uri) # super slow
print(f"ADBC connected in {perf_counter() - t:0.2f}s.")

# verify result
with conn.cursor() as cur:
cur.execute("SELECT 1")
print(cur.fetchall())
```
```
SQLAlchemy connected in 1.31s.
[(1,)]
ADBC connected in 153.66s.
[(1,)]
```

My uri is of the form `postgresl://username:password@server:port/database`. Is there another connection setting I'm missing that's causing the huge connection delay?

### Environment/Setup

Item | Version
----------------|----------
OS | Windows 10 Enterprise
postgres driver | 0.11.0
Postgres server | 9.4.26
Greenplum | 6.24.3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.