oci8 gem to query a database and fetch the results; however, the size of the query's results is unknown and may be too large to cache on an individual's computer. Is there a way to query the database, store the results on the server-side and then fetch each record from that set, one by one? Any help would be much appreciated.
Asked
Active
Viewed 627 times
0
-
Have you tried limiting the query with [oracle's `rownum`](http://docs.oracle.com/cd/B19306_01/server.102/b14200/pseudocolumns009.htm) – bjhaid Jan 30 '14 at 22:52
1 Answers
2
It is the only way which ruby-oci8 supports.
All Oracle cursors are server-side cursors. Fetched records are sent to the client only when the client requests more rows. FIY, maximum number of rows in the client-side cache is limited by OCI8#prefetch_rows= and OCI8::Cursor#prefetch_rows=. The default value is one. It is recommended to increase the size to 100 for large data.
Note: The default prefetch row size was changed to 100 in ruby-oci8 2.2.0.

Kubo Takehiro
- 389
- 2
- 5