If you set both parameters, the value in OCI_ATTR_PREFETCH_MEMORY
will be used. The best choice of setting depends on numerous factors such as network speed and the amount of client-side memory available. Both parameters are ignored when you bind arrays of columns.
If you specify OCI_ATTR_PREFETCH_MEMORY
, this amount of memory is allocated. If OCI_ATTR_PREFETCH_ROWS
is set, this value multiplied by the row size of memory is allocated. When a call to fetch is made all the memory allocated is used to store records from the server. The first call gets back n rows and subsequent calls to fetch do not make a network call until all n records have been returned from the client.
Use OCI_ATTR_PREFETCH_MEMORY
if your records vary greatly in length, but note that not all the memory will be used when fetching a result set much smaller than the allocated memory. This is not an exact science, so try alternative settings until there is no detectable performance increase.