User`s guide
5 Using Visual Query Builder
5-22
Method 2 — Data Does Fit In MATLAB Variable But Not in JVM Heap
If your data (n) does fit in a MATLAB variable but not in a JVM heap, you need to find h
such that h < n.
To use automated batching to fetch where h rows fit in the JVM heap:
setdbprefs('FetchInBatches','yes')
setdbprefs('FetchBatchSize','h')
If using exec, fetch, and the connection object conn:
curs = exec(conn,'Select….');
curs = fetch(curs);
If using runsqlscript to run a query from an SQL file 'filename.sql':
results = runsqlscript(conn,'filename.sql')
Note that when you use automated batching and do not supply the rowLimit parameter
to fetch or the rowInc parameter to runsqlscript, a count query is executed
internally to get the total number of rows to be imported. This is done to preallocate the
output variable for better performance. In most cases, the count query overhead is not
much, but you can easily avoid it if you know or have a good idea of the value of n:
curs = fetch(curs,n)
or
results = runsqlscript(conn,'filename.sql’,'rowInc','n')
Method 3 — Data Fits in MATLAB Variable and JVM Heap
If your data (n) fits in a MATLAB variable and also in a JVM heap, then you need not
use batching at all.
setdbprefs('FetchInBatches','no')
If using fetch:
curs = fetch(curs);
If using runsqlscript to run a query from an SQL file 'filename.sql':
results = runsqlscript(conn,'filename.sql')