Skip Headers

# Optimizing Streams

Previous

Next

To optimize `CursoredStream` performance, provide a threshold and page size to the `useCursoredStream(Threshold, PageSize)` method, as follows:

- The threshold specifies the number of objects to read into the stream initially. The default threshold is 10.

- The page size specifies the number of objects to read into the stream after the initial group of objects. This occurs after the threshold number of objects is read. Although larger page sizes result in faster overall performance, they introduce delays into the application when TopLink loads each page. The default page size is 5.

When you execute a batch-type operation, use the `dontMaintainCache` method with a cursored stream. A batch operation performs simple operations on large numbers of objects and then discards the objects. Cursored streams create the required objects only as needed, and the `dontMaintainCache` ensures that these transient objects are not cached.