Setting the Fetch Size

Goal

You want your application to generate a result set for optimal performance and memory usage.

Implementation

For the IOM driver, the default fetch size is calculated dynamically unless the fetch size is set manually with the setFetchSize method. The getFetchSize method returns 0 to indicate the dynamic sizing. The calculation is performed at run time by determining the width of a row in the result set, and then determining how many rows can be stored in a 16-kilobyte buffer.
This value works well in most cases, and also takes into consideration data sources that have either narrow rows (few columns or short CHAR columns) or wide rows (many columns or long CHAR columns). For data sources with narrow rows, the result set can hold many rows to improve performance. For data sources with wide rows, the result set holds fewer rows so that memory consumption does not reduce performance. Use the setFetchSize method to override this behavior.
The SAS/SHARE driver uses a default fetch size of 10 rows. This value can be changed with the setFetchSize method, but this driver does not perform a dynamic calculation for the optimal fetch size.