ODBC - Optimising performance - Reading records in batchesΒΆ
Optimising performance with ODBC - reading records in batches
In client/server mode, performance can be improved by reading records from specified keyed files in batches, using the form:
file_id->batch_read = ON
This feature is documented in detail under Reading records in batches.
When batch_read is set to ON for an ODBC file, Sculptor uses a cursor type that fetches records in batches, provided that such a cursor type is supported by the database in use. This is generally much faster than the default cursor type used when batch_read is set to OFF. When records are read in batches, the nextu, nextkey, prevu, prevkey and matchu commands may return a record that does not contain the most recent update. The batch_read flag is most useful when generating reports and when displaying information in read-only tables.
batch_read is OFF by default. Using the default improves the compatibility between ODBC tables and Sculptor files, but performance can be improved substantially with both ODBC tables and Sculptor files by turning batch_read ON when appropriate. Normally, the batch_read flag should be set ON for any loop that reads records in an unlocked state.
In the following example, setting the batch_read flag ON makes the loop run about 3 times faster:
EXAMPLE
MyFile->batch_read = ON
while (TRUE) {
nextu MyFile nsr - BREAK
...
}
MyFile->batch_read = OFF
RELATED TOPICS |