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
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- databases, performance, testing
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 1
- Fork
- 0
- Merge trung bình
- 1 giờ 19 phút
- Pull request đã merge (30 ngày)
- 122
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của liberation-data/drivine-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
liberation-data/drivine-python#252 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
liberation-data/drivine-python#250 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
liberation-data/drivine-python#209 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CI: three Oracle-only tests in test_cypher_compiled.py never run, as -k oracle doesn't select themĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
liberation-data/drivine-python#178 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
liberation-data/drivine-python#243 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của liberation-data/drivine-python
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Add alembic upgrade predeployĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ClockGU/clockwork-backend#169 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
aws-samples/sample-per-model-bedrock#616 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
chnm/teachinghistory-hugo#47 ·
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
pandas-dev/pandas-stubs#2047 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày