Iterator

A table iterator is used to iterate over all of the rows or a specific subset of the rows in the table. The create iterator operation submits a query on a data grid table and creates an iterator object to present the query results.

Supply a filter string as an argument to the create iterator operation. The filter string follows the syntax of the WHERE clause of a SQL SELECT statement excluding the WHERE keyword. All rows in the table for which the filter string evaluates to true are returned by the iterator.

An iterator object receives batches of matching rows from the data grid. The prefetch property of the iterator determines the batch size.

Properties can be set when an iterator is created thereby affecting the query behavior. For more information see Data Consistency for Queries.

The iterator object presents the program with the individual rows that match the query one at a time.

To release resources within the data grid component processes, the program must close the iterator object and close each row object retrieved by using the iterator.

An implicit timeout limits the lifespan of iterator objects. Program calls that access an iterator after that timeout elapses return an error.

Avoid queries that result in full table scans, which can be resource-intensive and time-consuming.

Related concepts