pg.ddx.io  psycopg/psycopg GitHub issues and pull requests  
help / color / mirror / Atom feed
From: jerch (@jerch) <noreply+jerch@github.com>
To: psycopg/psycopg <noreply+psycopg-psycopg@github.com>
Subject: Re: [psycopg/psycopg] issue #1157: proposal: retrieve range value dumper from inner_oid setting
Date: Fri, 17 Oct 2025 18:54:18 +0000
Message-ID: <gh-psycopg-psycopg-1157-c3416718877@github.com> (raw)
In-Reply-To: <gh-psycopg-psycopg-1157@github.com>
References: <gh-psycopg-psycopg-1157@github.com>

This changes the following usage pattern:
```python
with cur.copy(b'COPY "range_test" (r) FROM STDIN (FORMAT BINARY)') as copy:
    copy.set_types(['int8range'])  # int8 expected
    for left, right in range_data:
        # before - explicit with Int8()
        copy.write_row([Range(Int8(10), Int8(20))])
        # after - auto int8 type
        copy.write_row([Range(10, 20)])
```
Which overall runs ~2.5 times faster with full db roundtrip (the value dumping alone is ~4 times faster):
```text
# old
bench_range_db: 0.06474 ±0.00527 (cv: 0.081, repeat: 10)
# new
bench_range_db: 0.02713 ±0.00249 (cv: 0.092, repeat: 10)
```

view thread (16+ messages)  latest in thread

Message-ID: <gh-psycopg-psycopg-1157-c3416718877@github.com>
Permalink:  ../gh-psycopg-psycopg-1157-c3416718877@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox