26.0.x: higher client CPU per call for `fetchone()` / `execute()` compared to 4.0.2
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 32/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- databases, performance
Direzione di ricerca
Start by running the included repro_overhead.py against 4.0.2 and 26.0.1 in both thin and thick modes to confirm the fetchone() and execute() CPU gap while fetchmany() stays flat. Then compare how the two versions handle the per-row fetch path, since that is where the regression appears. Done means the per-call overhead is traced to a specific change and the numbers come back within a few percent of 4.0.2 in both modes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
- What versions are you using?
- python-oracledb: 26.0.1, compared with 4.0.2 (stock PyPI wheels)
- Oracle Database: 12.1.0.2.0
- Oracle Client (Thick mode): 19.18.0.0.0
- Python: 3.11.13
- platform.platform: Linux-6.18.54.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
- sys.maxsize > 2**32: True
- Is it an error or a hang or a crash?
Neither: performance regression.
- What error(s) or behavior you are seeing?
fetchone() and execute() use more client CPU in 26.0.1 than in 4.0.2, in both Thin and Thick modes. fetchmany() is unchanged.
Client CPU time measured with the script below (seconds, average of two runs, each run being the median of 5):
| Operation | Mode | 4.0.2 | 26.0.1 | Change |
|---|---|---|---|---|
fetchone() loop, 50k rows |
Thin | 0.182 | 0.237 | +31 % |
fetchone() loop, 50k rows |
Thick | 0.199 | 0.303 | +52 % |
2000 × (execute() + fetchone()) |
Thin | 0.383 | 0.445 | +16 % |
2000 × (execute() + fetchone()) |
Thick | 0.397 | 0.477 | +20 % |
fetchmany() scan, 50k rows |
Thin | 0.169 | 0.179 | +6 % |
fetchmany() scan, 50k rows |
Thick | 0.190 | 0.190 | 0 % |
- Does your application call init_oracle_client()?
Both modes were measured (Thin and Thick).
- Include a runnable Python script that shows the problem.
No schema needed. Run once with each oracledb version:
ORA_USER=... ORA_PASSWORD=... ORA_DSN=host:port/service python repro_overhead.py thin
ORA_USER=... ORA_PASSWORD=... ORA_DSN=host:port/service python repro_overhead.py thick
import os
import statistics
import sys
import time
import oracledb
MODE = sys.argv[1] if len(sys.argv) > 1 else "thin"
ROWS = 50_000
N_EXEC = 2_000
REPEAT = 5
if MODE == "thick":
oracledb.init_oracle_client()
oracledb.defaults.arraysize = 100
oracledb.defaults.prefetchrows = 101
conn = oracledb.connect(user=os.environ["ORA_USER"], password=os.environ["ORA_PASSWORD"],
dsn=os.environ["ORA_DSN"])
SCAN = f"""select level, level / 7, date '2026-01-01' + mod(level, 365), 'row_' || level
from dual connect by level <= {ROWS}"""
ONE = "select :k, 'x' from dual"
def s1_fetchmany():
with conn.cursor() as cur:
cur.execute(SCAN)
while cur.fetchmany():
pass
def s2_execute_fetchone():
with conn.cursor() as cur:
for k in range(N_EXEC):
cur.execute(ONE, k=k)
cur.fetchone()
def s3_fetchone():
with conn.cursor() as cur:
cur.execute(SCAN)
while cur.fetchone() is not None:
pass
def cpu(fn):
fn() # warm-up
samples = []
for _ in range(REPEAT):
c0 = time.process_time()
fn()
samples.append(time.process_time() - c0)
return statistics.median(samples)
print("oracledb", oracledb.__version__, MODE)
print(f"fetchmany() scan of {ROWS} rows : CPU {cpu(s1_fetchmany):.3f} s")
print(f"{N_EXEC} x (execute() + fetchone()) : CPU {cpu(s2_execute_fetchone):.3f} s")
print(f"fetchone() loop over {ROWS} rows : CPU {cpu(s3_fetchone):.3f} s")
- Lingua principale
- Python
- Stelle
- 455
- Fork
- 119
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di oracle/python-oracledb
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
oracle/python-oracledb#623 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
oracle/python-oracledb#622 ·
-
Client Library or Database
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
oracle/python-oracledb#620 · 4 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
oracle/python-oracledb#619 ·
-
asyncio: DPY-4011 on connect_async() when the listener closes the original socket after a redirectForse già presa @AlexGracas l’ha presa 16 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
oracle/python-oracledb#616 ·
Tutte le issue di oracle/python-oracledb
Issue simili
-
resource-submission validation-passed
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
hesreallyhim/awesome-claude-code#3214 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
room-commons replace accepts an empty old string and silently prepends the new text to the pageAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
doobidoo/mcp-memory-service#1650 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ml-explore/mlx-lm#2002 ·
I maintainer di solito rispondono entro 2 giorni