-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading large chunk of data from cursor returned from a stored procedure is extremely slow #482
Comments
Can you provide a test case that we can run independently that demonstrates the problem? You can try a few different combinations to see if configuration is the issue:
You can also examine the output from setting the environment variable |
Don't forget to tune the data fetch buffer sizes: https://cx-oracle.readthedocs.io/en/latest/user_guide/tuning.html#tuning-fetch-performance |
In my case the problem is in the function that runs too long. |
So, yes, execution halts at
PL/SQL Developer getting that cursor for 20s, but we finally got 140s from there as well - so the problem is inside that procedure, in SQL query returning into On a side note, maybe it will be useful to add |
By the way, setting
That code will throw a |
I didn't get an error with your sample. Can you recheck?
Output using my very remote DB is like:
I've noted that the RefCursor.py sample should show how to set the prefetch & array sizes. I also have noted the earlier comment about Tuning doc and tracing. [I updated the code regarding prefetching based on later comments] |
On reflection,I suspect |
Yes, |
I get error with |
We have confirmed that |
Are you sure this fixes the problem? Reading code in the commit fixing the issue i see only this exception raised: |
Yes, it does. There is a test case that demonstrates that as well. Give it a whirl and confirm for yourself! |
Assuming this has been resolved since it was included in cx_Oracle 8.1 released in December 2020! |
Yes, the issue was resolved. Didn't see |
What versions are you using?
Oracle Database 11.2.0.4
platform.platform: Linux-3.10.0-1127.el7.x86_64-x86_64-with-centos-7.8.2003-Core
sys.maxsize > 2**32: True
platform.python_version: 3.6.10
cx_Oracle.version: 8.0.1
cx_Oracle.clientversion: (12, 2, 0, 1, 0)
Describe the problem
We have a stored procedure with
OUT
parameterREF CURSOR
. When we had aroud ~1k records returned performance was good enough. Now it goes beyond 140 seconds with 50k.While executing the same procedure and parameters, reading cursor from
PL/SQL Developer
IDE is very fast, so query is not the problem.So what's strange code execution stops on first
data_cursor.fetchmany()
and most of the time (like 130s of 140s) is running firstfetchmany()
, then it reads very fast and continuing calls offetchmany()
goes fast as well.The text was updated successfully, but these errors were encountered: