@@ -245,11 +245,10 @@ Avoiding Premature Prefetching
245245
246246There are two cases that will benefit from setting ``prefetchrows `` to zero:
247247
248- * When passing REF CURSORS into PL/SQL packages. Setting ``prefetchrows `` to 0
249- can stop rows being prematurely (and silently) fetched into the
250- python-oracledb or Oracle Client (in python-oracledb Thick mode) internal
251- buffer, making those rows unavailable to the PL/SQL code that receives the
252- REF CURSOR.
248+ * When passing REF CURSORS *into * PL/SQL packages. Setting ``prefetchrows `` to
249+ 0 can stop rows being prematurely (and silently) fetched into the
250+ python-oracledb internal buffer, making those rows unavailable to the PL/SQL
251+ code that receives the REF CURSOR.
253252
254253* When querying a PL/SQL function that uses PIPE ROW to emit rows at
255254 intermittent intervals. By default, several rows needs to be emitted by the
@@ -259,28 +258,34 @@ There are two cases that will benefit from setting ``prefetchrows`` to zero:
259258Tuning Fetching from REF CURSORS
260259--------------------------------
261260
262- In python-oracledb, fetching data from REF CURSORS can be tuned by setting the
263- values of ``arraysize `` and ``prefetchrows ``. The ``prefetchrows `` value must
264- be set before calling the PL/SQL procedure because the REF CURSOR is executed
265- on the server.
261+ The internal buffering and performance of fetching data from REF CURSORS can be
262+ tuned by setting the value of ``arraysize `` before rows are fetched from the
263+ cursor. The ``prefetchrows `` value is ignored when fetching *from * REF CURSORS.
266264
267265For example:
268266
269267.. code-block :: python
270268
271- # Set the arraysize and prefetch rows of the REF cursor
272269 ref_cursor = connection.cursor()
273- ref_cursor.prefetchrows = 1000
274- ref_cursor.arraysize = 1000
275-
276- # Perform the tuned fetch
277- sum_rows = 0
278270 cursor.callproc(" myrefcursorproc" , [ref_cursor])
271+
272+ ref_cursor.arraysize = 1000
279273 print (" Sum of IntCol for" , num_rows, " rows:" )
280274 for row in ref_cursor:
281275 sum_rows += row[0 ]
282276 print (sum_rows)
283277
278+ The ``arraysize `` value can also be set before calling the procedure:
279+
280+ .. code-block :: python
281+
282+ ref_cursor = connection.cursor()
283+ ref_cursor.arraysize = 1000
284+
285+ cursor.callproc(" myrefcursorproc" , [ref_cursor])
286+ for row in ref_cursor:
287+ . . .
288+
284289 .. _roundtrips :
285290
286291Also see `Avoiding Premature Prefetching `_.
0 commit comments