Cypher on Oracle: a list literal of 1,001 items read three times through a WITH spends 815 MB of PGA and keeps 217 MB
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- databases, performance, testing
调研方向
Start by reproducing the Oracle memory measurements described here, especially the 1,001-item list carried through WITH and read three times. Compare the generated SQL and PGA use with the single-read cases, then trace the Oracle compiler and connection execution path; the issue says the Oracle json_array and json_object compilation is unchanged. Done means the statement no longer causes excessive PGA use or ORA-04036 under the reported test-suite conditions, while the list literal test remains meaningful.
由索引模型根据 Issue 内容生成。
描述
Found while porting liberation-data/drivine4j#362 (#192).
What happens. On Oracle, WITH <list of 1,001 items> AS xs RETURN [size(xs), xs[-1], xs[999]] makes a session spend 815 MB of PGA. The list mixes seven kinds of item, a null among them: [0, 's1', null, 3.5, true, [5, 'n'], {k: 6}, 7, ...]. The compiled statement is only 34 KB. After the statement ends, the session still holds 217 MB. Two such sessions, or one beside the rest of the test suite's sessions, pass Oracle Free's 2 GB PGA_AGGREGATE_LIMIT, and the statement fails with ORA-04036.
In two full runs of ORACLE_TESTS=true uv run pytest, the sync copy of #192's test failed on exactly this step with ORA-04036. Its async copy, run earlier in the same suite, passed both times, and so does the test run on its own.
Measured on a fresh gvenzl/oracle-free:23-faststart session, the statement prepared with cache_statement=False as OracleConnection runs it. Values are session pga memory max and, after the statement, session pga memory:
| statement | items | SQL | PGA peak | PGA after |
|---|---|---|---|---|
RETURN <list> |
250 | 8 KB | 51 MB | 17 MB |
WITH <list> AS xs RETURN [size(xs), xs[-1], xs[248]] |
250 | 10 KB | 214 MB | 60 MB |
RETURN <list> |
1,001 | 33 KB | 181 MB | 50 MB |
UNWIND <list> AS x RETURN x |
1,001 | 33 KB | 182 MB | 50 MB |
RETURN [x IN <list> WHERE x IS NOT NULL | x] |
1,001 | 33 KB | 182 MB | 50 MB |
WITH <list> AS xs RETURN [size(xs), xs[-1], xs[999]] |
1,001 | 34 KB | 815 MB | 217 MB |
Reading the carried list three times in the projection costs about 4.5 times what reading it once does. Each read is a CASE JSON_VALUE(w2.c1, '$.type()') ... over the whole array. Even once, a 1,001-item literal costs 181 MB.
Not caused by #192. That change leaves Oracle's SQL for these statements as it was (the Oracle compiler's json_array/json_object are untouched).
Workaround in the test. #192's test_a_list_literal_of_more_than_100_items_... asks Oracle no list of 1,001 items (see the comment below).
Other libraries. drivine (TS) compiles nearly the same Oracle SQL for this statement (42,170 vs 42,196 characters), so it should behave the same. Its port of the test passed in its full suite, where the Oracle sessions happen to leave enough headroom. drivine4j isn't measured.
- 主要语言
- Python
- 星标
- 1
- 派生
- 0
- 平均合并
- 1 小时 21 分钟
- 30 天内合并 PR
- 128
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
liberation-data/drivine-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
liberation-data/drivine-python#250 ·
维护者通常 1 天内回复
-
bug
难度 1/5 1 小时以内 新手友好度 88/100
liberation-data/drivine-python#209 ·
维护者通常 1 天内回复
-
CI: three Oracle-only tests in test_cypher_compiled.py never run, as -k oracle doesn't select them未关闭
难度 1/5 1 小时以内 新手友好度 88/100
liberation-data/drivine-python#178 ·
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 45/100
liberation-data/drivine-python#280 ·
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 68/100
liberation-data/drivine-python#279 ·
维护者通常 1 天内回复
查看 liberation-data/drivine-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
-
Validate finite output clamping limits in StepPredictor.prepare_clamping_params to prevent silent NaN/Inf propagation可能已有人在做 @muskan-creates352 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
mllam/neural-lam#848 ·
维护者通常 2 天内回复
-
infra
难度 1/5 1 小时以内 新手友好度 88/100
fab-geocommuns/RNB-coeur#1166 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
deepspeedai/DeepSpeed#8951 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
aws/context-ontology-accelerator#343 ·
维护者通常 1 天内回复